: http://blog.csdn.net/yanzi1225627/article/details/49123659; Y* I3 f! V* E/ J& S
) Q9 ?% W5 P* A2 A |( ^
格嚗剖遣LNMP嚗Linux 嚗 Nginx 嚗 MySQL 嚗 PHP 嚗SVN嚗嚗嗡葉svn舐冽乩誨瞞tp嚗嫣噶撘銝剛霂甇乩誨 詨喟桀嚗頧臭辣賢鋆/www/桀銝嚗肓ww桀銝啣遣web隞嗅允雿銝箇蝡寡楝敺嚗www桀銝啣遣wwwsvn雿銝漳vn隞摨啣/www/software冽交駐ginx嚗mysql嚗php摰鋆皞nginx餈銵蝏韐行暈ww:www 銝嚗摰鋆憭yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel cmake; [8 e( D) ?" [! d8 {! x
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx3 L- t2 f0 i3 Z& Y) y5 K. [! M/ t5 @
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www J9 Y8 s' n9 U
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx5 A, E* r9 e) S; M6 V7 [( s, U8 I
6 j r: S1 Y {0 [0 }& i
chkconfig --add nginx- p" O# L) o! o a; S0 c" r
, x9 x4 q4 y7 z* }, h/ F' g
chkconfig nginx on
4 t' ~ X+ v: M$ l$ O1 n3 O 嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash+ F$ S! I! R$ W8 ^1 O$ o
# nginx Startup script for the Nginx HTTP Server
8 I# [& u, A2 Q5 P$ B% P6 n# it is v.0.0.2 version.
2 H8 S# i9 k. S; W( b# chkconfig: - 85 157 p h# J* Y1 [, P+ w+ O1 ^
# description: Nginx is a high-performance web and proxy server.% O D9 |3 g* o6 ]9 a. c
# It has a lot of features, but it's not for everyone.6 v2 V { S/ F/ I$ |. X
# processname: nginx
) p4 K' D' S/ b4 j0 _; p- {$ f) |# pidfile: /var/run/nginx.pid
$ b( e# Y; i8 W6 h5 {. v( Q# config: /usr/local/nginx/conf/nginx.conf
s8 X+ Q% d0 R$ Y) ~6 h( |# Rnginxd=/www/nginx/sbin/nginx
1 h1 Q) s* L/ n4 J6 anginx_config=/www/nginx/conf/nginx.conf
6 E0 a; G& E4 {) R5 S+ rnginx_pid=/www/nginx/logs/nginx.pid
/ I# w: a. d& K& b$ L$ ]& rRETVAL=07 P0 n: S! k/ z% W/ A7 d. P6 b* M
prog="nginx", w3 C5 J0 Q: W3 B
# Source function library.5 s2 z3 }1 d- V- x' _) \2 V$ Q. F5 o
. /etc/rc.d/init.d/functions
0 c: ]4 O! w1 E) a! m# Source networking configuration.
6 @/ j$ f' {( Q, k0 I9 ]. /etc/sysconfig/network" J! Z, d- N1 m3 O+ F- ~* g) ?
# Check that networking is up.
6 Y8 u/ H/ V# Q: G$ G- o% X[ ${NETWORKING} = "no" ] && exit 0
/ f8 N: \7 w0 B1 S( a[ -x $nginxd ] || exit 0/ ~, T* {/ `! i( a$ }; [# U
# Start nginx daemons functions.5 ]; \' C" J) U. t
start() {
0 o- Z( T+ n! }if [ -e $nginx_pid ];then
0 m/ ]$ `0 T6 y+ recho "nginx already running...."9 H% B& V7 p7 R5 v: p
exit 1
8 y4 D2 T5 F1 N% Q( e* j6 I; y( rfi
0 u: `1 g7 k/ t2 s7 decho -n $"Starting $prog: "
7 V8 w L8 K; kdaemon $nginxd -c ${nginx_config}
& D) s2 c9 R# p: ]RETVAL=$?/ k, j3 W; t7 h/ d' x5 R% Y9 q& k
echo: ?- Y9 P. c! R8 B I
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
) r' ?8 S- n+ z8 |7 Jreturn $RETVAL+ q! J* C) Q, G# r- v" y! I
}
/ J z7 @" j* R# Stop nginx daemons functions.
, s: V: o1 ~. d6 q# t, ?stop() {0 q9 a `' _. {
echo -n $"Stopping $prog: "% X' P6 [+ W' h# O$ v
killproc $nginxd8 Y0 R/ v% @0 B% l# W0 @9 t
RETVAL=$?1 z6 n( {5 F8 _
echo
5 g+ k, ?* H1 x[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid; o# E3 |4 q. ~1 R& Y( q! l3 }
}
" l1 l$ @2 \1 A. c$ Z& f# @reload() {
4 ~* ?' n, \" K, [6 d' ]" [9 ?/ Mecho -n $"Reloading $prog: "
% M1 W. e7 [& ?8 U: K#kill -HUP `cat ${nginx_pid}`" P( e$ U" H! a5 A# ^
killproc $nginxd -HUP
6 d5 Y7 }" h0 h- |, y: B5 x' yRETVAL=$?; u. d! M+ r M7 L
echo- K3 j7 L7 Y7 F' x1 j
}$ O3 u5 C4 c" x+ y$ [
# See how we were called.
4 J! S/ c% o# u& zcase "$1" in; f; q3 B7 X+ ~1 \3 O
start)
& u; S+ A* Z3 Hstart$ M% j. k- Q8 f; N0 E6 Y. s
;;
% _7 T+ Z+ c% o+ `( Z0 dstop)
8 C0 I, H* ^$ o$ |3 Z! E1 I8 n0 @stop3 J2 t% S: i/ | B( D
;;
1 g8 g2 K' J& x; Mreload)
# ] b* p6 M2 {; Sreload
* C, M% g$ S$ b v4 \;;
7 d, z- X* G3 Z' F" wrestart)
; I0 }6 F. n2 t$ x" {$ a3 o$ d& S0 Fstop0 ]2 b1 S, G- |3 j# k
start) F5 z. N8 E6 ~) D! z2 _7 ^: u
;;
: v" ]- A' a! P) A3 vstatus)
: W) A5 X6 w: V+ n5 A% v% qstatus $prog2 V" @0 U k8 b' z" y
RETVAL=$?
/ Y! O( W7 F6 E7 b2 N;;
9 \$ [. @; C8 e' w*)& }3 D3 u. i' v* m# @/ y$ h
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
7 C0 z& z" L8 E! W6 h, h$ {6 G @7 Mexit 16 M; X4 P4 H* j) k. U# r
esac9 F& D1 A/ X+ Q) I4 K
exit $RETVAL
7 C7 h) ~# j$ A6 }* F$ y- }6 {1 X/ L+ f/ S; \" ~6 |4 s+ f
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 ; B* X, U4 a2 Z. c
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗% |+ G8 ~4 E# M
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 : N: V; C( T) |4 y3 _- t4 S
location / {
# e0 t6 I% f& D! o- H X# h1 @ root html;7 ~* u! F; ~1 n2 c3 t
index index.php index.html index.htm;
: G8 R) @ j0 K: t }
5 ?' R( N8 W- C' x4 v靽格嫣蛹嚗9 J6 g2 o( M0 e' A8 i$ O& p7 D
$ X- c! ~# G: n; |% n- N8 k6 P location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
& b: ]. s6 B" [( t5 glocation ~ \.php$ {
P7 w( I( \% {8 [7 j$ l root html;2 {9 _7 e4 _2 E9 T! n6 P
fastcgi_pass 127.0.0.1:9000;
8 N t: W" U$ P5 B5 p6 C9 Q* k& R fastcgi_index index.php;5 z. x& [6 L) {( H1 ~
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
6 ]/ x* y3 }6 O/ H; E$ { include fastcgi_params;7 [3 Y$ m! ]; Z" `' n6 H, L
}
& R0 K7 n: {( z" M5 Q( Q4 `: s靽格嫣蛹嚗, r! _+ ^4 c5 A6 `' G5 ~
0 ~7 D# [% l9 |* G' U' \( u location ~ \.php$ { root /www/web; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; #include fastcgi_params; include fastcgi.conf; } 嗅撠得k鈭蝚砌銝芷桅頝php游嚗敺摰鋆摰瘥php氬 銝嚗摰鋆MySQL閫蝻拙僎餈唳桀嚗扯嚗
: }* X' Z" G2 z9 B: R6 U#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql" s3 |8 H8 Q% C0 @ Z; L
* ?7 H v4 w# }8 A ~
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏4 s7 X* m' ]% V( Z; b
扯 cat /etc/passwd 亦冽瑕銵
4 k: o' T3 j& Jcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
- o- }4 g2 L( V: c; E 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
3 E6 Z6 I, ]! U0 `" m& R+ W 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
- L1 X C8 `9 C2 [# r/ j% Ichkconfig mysql on; J4 k7 u f& ]# E" g- n
service mysql start --臬決ySQL, B. h( |6 {# P7 N; I$ Z# J; ~% M3 }
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
% K6 w2 z6 k7 Xexport PATH
/ t. Q# @! X6 V1 L! J. V 靽摮source /etc/profile 扯嚗 4 I+ K9 Y+ c" U; P0 `
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');5 t# @: R: m" [. \
' P' U Q5 o% a, ^& X$ j" }' o) X霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
9 N+ i4 M- ~7 |mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 8 V% t, ?0 X" w* d/ E; M
#./configure --prefix=/www/php --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-openssl --with-libxml-dir --with-zlib --enable-mbstring --with-mysql=/www/mysql --with-mysqli=/www/mysql/bin/mysql_config --enable-mysqlnd --with-pdo-mysql=/www/mysql --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --with-curl 嗅make make install亦閬隞乩鈭嚗 1嚗游nginx嚗臬私hp 餈軏d /www/php/etc/ 桀銝嚗瑁php-fpm.conf.default 銝歉hp-fpm.conf扯/www/php/sbin/php-fpm start 臬私hp嚗fpm 2嚗蝵峰hp.ini 撠摰鋆皞/www/software/php-5.6.14/php.ini-production 瑁郡hp摰鋆桀lib隞嗅允銝 3嚗憒閬摰鋆curl拙霂嚗銝Yconfigure撌脩撣虫嚗嚗餈唳ext/curl桀銝嚗靽霂菔銝撌脩摰鋆鈭curlcurl-devel,嗅嚗 a嚗/www/php/bin/phpize 隞乩嚗銝箔嫣噶臭誑餈銝芰桀/etc/profile嚗 & A- F4 V! Q- _
PATH=/www/php/bin:/www/mysql/bin: $PATH export PATH b,./configure --with-curl --with-php-config=/www/php/bin/php-config銋make make install嚗curl.so隡 /www/php/lib/php/extensions/no-debug-non-zts-20131226桀銝嚗嗅蝻颲php.ini曉送xtension_dirextension靽格孵喳胯 雿輻 yum 瘥頛嫣噶: 隞乩舫撠 centOS 6.x/x86_64: yum install php php-mysql php-fpm php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel 隞乩舫撠 centOS 5.x/i386: rpm -ivh http://mirror.yandex.ru/epel/5/i386/epel-release-5-4.noarch.rpm
* v; p, V- |1 R8 n6 m/ F# P- M# F: R# K5 z# S" L
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm4 i9 h1 ~- x$ ^/ ~( c- P* f
Create /etc/yum.repos.d/php-fpm.repo file and add:
! B$ [* r/ G/ R' F6 O- s- [nginx]: }( X$ r9 f5 ~. W8 `0 Q* J' A
- name=nginx repo
( h$ y: a- G, K9 }& z5 _3 \ - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ ^2 ]; G& M% W; A6 X. P
- gpgcheck=0
( u& l7 U( W4 k+ s - enabled=1
銴鋆賭誨蝣 5 ?& n4 E7 D9 s2 x2 f2 p, ~: B* v
yum --enablerepo=remi,remi-test install php-fpm4 F+ N7 X* b+ @! b# i& k- k
0 j& b3 n* N0 [2 w3 J% U. y1 v" V0 n* {" g. Z( Z S" u o/ [( j
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn* V6 [7 e* {2 ?2 P2 c
嚗yum remove subversion //貉蝸雿祉svn
( z; ~$ K: |) C& ^ # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn" T: n3 h& B+ P/ d3 l' z! T
餈# svnserve --version撉霂臬血鋆乩亙停臬撱箔摨撟嗡web桀甇乓 1嚗mkdir -p /www/wwwsvn 甇斗隞嗅允撠望盎vn隞摨. svnadmin create /www/wwwsvn 撱箔摨嚗扯銝餈啣賭誘嚗臭誑圈Xconf, db,format,hooks, locks, README.txt蝑隞塚霂湔銝銝杵VN摨撌脩撱箇嚗ps嚗甇文臭誑餈svnserve -d -r /www/svndata 撱箇svn砍桀嚗嗅svnadmin究vndata桀銝啣遣隞摨嚗 2嚗蝵桃冽瑕撖 肓wwsvn銝餈軏onf隞嗅允嚗X銝銝芣隞塚authz passwd svnserve.conf閬蝻颲 嚗vim passwd //霈曄蔭冽瑕撖 [users]
P8 {; y, z& ^7 R0 Y3 t# harry = harryssecret
- I3 d5 _: f( b9 h% x5 {; E# sally = sallyssecret
C; l: t3 i7 I: g0 Dwangning=wangning
0 T' C; ~1 E- L" ^: lyanzi=yanzi
, p. P b- l& o$ y/ W* T$ [) W #vim authz //霈曄蔭
4 t4 W0 g* Y& r' T: r$ l[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none9 o& G5 b* k8 R
auth-access = write$ l" |% C! A& o
### The password-db option controls the location of the password; b& ]8 L% O, Q/ q
### database file. Unless you specify a path starting with a /,
+ s4 W4 H S( o; c; I. U3 Q### the file's location is relative to the directory containing4 J! q* g* h' h3 g5 V' R, y% ^6 ~% @
### this configuration file. D, O3 R8 Z+ Y
### If SASL is enabled (see below), this file will NOT be used.
3 y0 L: Z5 @& m+ v- P* v1 K### Uncomment the line below to use the default password file.
" W7 v9 D' b% T' g1 U; G5 y" y' kpassword-db = passwd
$ o. d! j, Q7 ~# E# v, w& w; e### The authz-db option controls the location of the authorization- M& |( b# k) R& M0 W
### rules for path-based access control. Unless you specify a path
c4 ?4 B/ a1 ]4 J### starting with a /, the file's location is relative to the the
V8 m! Q2 Z; g9 ]6 l9 @& i! E r+ B### directory containing this file. If you don't specify an
5 P2 `: f: A( q### authz-db, no path-based access control is done.
# y7 p" x, V2 V4 z9 b### Uncomment the line below to use the default authorization file.
% q0 E; l; ?' X; dauthz-db = authz7 [- ` x' W% n
### This option specifies the authentication realm of the repository.: z- f8 b% y2 p7 `1 s
### If two repositories have the same authentication realm, they should
' \( U9 V( K t; Z3 W### have the same password database, and vice versa. The default realm7 R0 J. G- R, X3 ^; h
### is repository's uuid.. g8 M% C5 N3 g) F# v: X3 {( {
realm = My First Repository
$ c6 V6 v) `3 I4 e G( ~ 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
) O1 C+ n- R9 J( X #killall svnserve //甇2 ^; o0 [& G, G/ f J& i3 @# `
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
5 P4 c8 p" K2 m. e# ^6 |: ~/ |+ `" v 4,蝵峰ost嚗commit 蝏餈銝餈圈蝵桀嚗svn隞摨啣/www/wwwsvn, 雿眨eb寧桀/www/web,銝方銝臭銝芰桀嚗瘜svn push銝亙停唬具 a嚗擐究erver蝏蝡舫嚗嚗svn co svn://192.1.15.222 /www/web 霈啣撠/www/web桀靽格嫣蛹www:www chown -R www:www /www/web/ J% @/ i7 y7 K A
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
' T. [- X4 g; Y: `1 Y; ]export LANG=zh_CN.UTF-8 svn up --username yanzi --password yanzi /www/web/ chown -R www:www /www/web/ 嗅撠曹ok鈭嚗典┬vn commitweb桀銋撖孵隞嗅改 ps:1嚗svn upY摮撖臭霈曄svn冽瑯 2嚗銝├p撠望真pdate嚗git亦閫嚗撠望舀銝芯摨A嚗嗅啣遣鈭銝朋餉頦服嚗瘥甈,鈭斤嗅嚗霈咕銋pull銝銝餈乓究vn真pdate 3 , 鋆摰nginx php-fpm 撠 SElinux 摰冽輻,血蝬脤箇 "Access denied" :: s! ]8 {) X. Z. K' J$ o
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 ' V; W, w* u# U9 u7 j4 C# ~5 y
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled . e. s& i: I$ a, Z
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
0 K7 N2 k% ?$ M2 C |