: http://blog.csdn.net/yanzi1225627/article/details/49123659' _4 C' Q$ ?6 q; M# W
) p: s3 z& x+ W% 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
! X9 _3 V( p7 o0 u: Z 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
P8 J- P c5 a. D 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
. O9 A$ X( K0 c& ~/ e+ S( Z5 L/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx6 H" H* Q7 ?8 m/ V/ `$ T" h
9 M: R& m0 k' h* D7 L3 q" H* I
chkconfig --add nginx$ u# V6 t% n# _- n6 Q0 z- B' Q
# q: M9 i* s' g; bchkconfig nginx on# E! @% G, S4 D' s8 M, V: j) v) ]
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
5 w, u/ E3 m' i2 U# nginx Startup script for the Nginx HTTP Server
$ u# n6 E/ e5 _# it is v.0.0.2 version.
0 F0 z; I# e8 ]* O9 i* W# chkconfig: - 85 15
7 @" K O5 E* ]& b# G# description: Nginx is a high-performance web and proxy server.% f! w# J1 l' U, A! V
# It has a lot of features, but it's not for everyone.9 E5 ]4 h$ T" O5 P' M
# processname: nginx
9 u$ Z3 f; h9 l3 U' z# pidfile: /var/run/nginx.pid
' g1 B2 f; H% V7 q7 c5 L# config: /usr/local/nginx/conf/nginx.conf9 l7 k; z- B) m4 M# ]& e+ A
nginxd=/www/nginx/sbin/nginx8 v) j0 T, [6 S& v; O, \! ?" }
nginx_config=/www/nginx/conf/nginx.conf) [9 i7 O d2 ~5 O2 Y
nginx_pid=/www/nginx/logs/nginx.pid! ~1 R6 V. L5 {$ b: ]
RETVAL=0
5 D8 @* g: i$ p; ~; P6 y+ o& j" ]prog="nginx"$ |# t4 E5 M3 N* x7 m0 B
# Source function library.
4 l, [4 X n% a) a) g' W. /etc/rc.d/init.d/functions
: N3 q" | M8 b/ G( a# Source networking configuration.
4 @4 d2 |, G3 j, S8 p- Z. /etc/sysconfig/network9 `0 H. Q/ U4 {# J+ h
# Check that networking is up.
! D1 F, ]- O( w- `; a3 S% R[ ${NETWORKING} = "no" ] && exit 0( c9 Y; Q1 @- Y/ n2 P% C( y
[ -x $nginxd ] || exit 0
* Y5 ?2 M) U6 M/ z9 m) j0 Z# Start nginx daemons functions.+ r& s) H9 ?8 U4 r
start() {5 A; f% y6 T$ B5 \, Y U% o% N! O
if [ -e $nginx_pid ];then$ ~! `& y7 L( h4 S4 w8 c1 w
echo "nginx already running...."- R$ f0 n j: H
exit 1
/ i$ I- O! N, r: ~* } ?) vfi% {: O5 j$ D% [ n9 ]1 C4 f
echo -n $"Starting $prog: "
. h/ p" N+ p: a. ]! M. B, Z$ jdaemon $nginxd -c ${nginx_config}
9 C+ Z1 v! J6 u1 VRETVAL=$?; D* C7 `: O( I
echo
5 o2 S+ R: b! K[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
2 s' q$ f6 p, ?% ^9 f# z% s2 s% Hreturn $RETVAL4 E& }& s* d7 m
}3 C& O n, U; r2 d
# Stop nginx daemons functions.- c* l5 S) D4 g6 l1 z" X
stop() {" L( T. m! c7 M# F" R: a
echo -n $"Stopping $prog: "6 Z. u9 W+ t5 i! M9 L1 V. O3 W0 [
killproc $nginxd- x' f+ r& K" e
RETVAL=$?9 D' }( v7 W$ c/ C0 A- [6 \
echo
- S5 x3 L. u. i3 v' K/ B3 F[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
4 [& \! Y9 c8 H! x% r1 o, L0 [}$ {/ o3 Q6 G5 Q
reload() {8 M" \9 |. Y2 ?5 q
echo -n $"Reloading $prog: "
- ?6 u) X5 A+ I: x" q* u" y5 I7 V#kill -HUP `cat ${nginx_pid}`5 w2 L. \# b1 \- t1 @. n1 d
killproc $nginxd -HUP$ Y3 B/ ?# c6 @& A
RETVAL=$?6 } j; S) g# U1 G ]' Q) Y- O$ S
echo V: x. {' `+ n/ y0 k+ d
}* U! C; A4 h6 w4 Z3 f
# See how we were called.; M7 D, _" Z! U+ ^$ a9 u
case "$1" in
; Y* g, r: Z3 K3 e! [7 w1 {' estart)
& _) ~; ?4 w5 I: S3 ostart8 j% P1 B9 L" E( P# l. M
;;
$ y9 W( m( C+ ]0 E9 p6 ystop)
8 |& S/ P% Z4 b2 hstop5 p6 C0 {% {2 U
;;6 G: j {( l/ `% s( z. `
reload)
3 W7 t+ P9 h) K1 hreload
+ D4 o# F' n) B) j;;
) i& A( `$ }7 f! Arestart)
; G. d4 h$ C5 q& T/ C d2 t( Hstop
+ a) A2 ~& m& i' q2 v& z0 [% U+ Rstart
: ~* z; L9 H: \! H' g9 ~" u;;
2 o* b% ]+ N& b' r B3 cstatus)3 `5 L; f, ^* n& T
status $prog. a" V+ }0 d2 p
RETVAL=$?
, L3 s. ]( g' o8 {7 P;;
2 C* S+ m, k2 C*): X" T- a6 p* p2 C
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
" Q6 q6 R" \0 Y/ S4 y4 m, rexit 1
- p8 W/ _6 C% F8 o- H1 @9 kesac* ]1 N; B7 R) Y/ n" i
exit $RETVAL8 {0 B* L- l q% `- C# F
1 L2 O! O: v j0 G) O& Z5 c& B0 z 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 6 N& O' R3 j3 f7 e
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
6 ^5 V# v& K: i1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
; @2 G R# U1 k! F% q7 S& l _/ q location / {
& n% ~8 V: b/ D8 f! u root html;( B: D4 N0 f- V# D
index index.php index.html index.htm;; m* ], O* G. H2 T$ F( S( K
}
' @# ^/ e- _# Z8 ?; V$ w靽格嫣蛹嚗) a9 \6 t0 `! e' e/ C# |* T, c
6 F7 { }; M1 E+ ~7 a
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 6 {/ \- f9 N8 J, A. q% ~6 K( G
location ~ \.php$ {
7 V6 s$ ? x! E; U4 R8 o9 F) _ root html;
# @; F# \/ C: z6 ]4 j/ {3 L3 Q fastcgi_pass 127.0.0.1:9000;$ V1 X' [6 a! e( l/ E" E
fastcgi_index index.php;
% m6 t$ s. M0 v( a) N' s) D9 c fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
P* e- g1 f9 Q7 \, Y6 [. ?7 y include fastcgi_params;4 G; g0 @: @6 B
}
! t" k1 P6 M/ Z* p靽格嫣蛹嚗/ F8 M) C- M' M. ~
, M0 Y% Z f7 O3 x2 {! H 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閫蝻拙僎餈唳桀嚗扯嚗 ! v" V* W3 s( u3 s3 D: A7 Z
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
; r5 I7 S- g7 F1 ?" s6 _% t
& k$ s5 ^# T& S) j' J1 q9 b) e#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏
1 T9 z- K; U ~1 R5 X 扯 cat /etc/passwd 亦冽瑕銵
" n4 z! D1 g2 n5 ~cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀+ b* o" ^% m4 r, h& }
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
( J( f2 q. F8 x5 R$ |0 n 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql# ^7 W S& O# E
chkconfig mysql on; s: W1 A. M. d4 l
service mysql start --臬決ySQL
4 r& C+ F; R8 H' V/ V/ } 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
( s5 \- i o3 Z! f# pexport PATH' ^+ Y7 K& \0 _+ B; `; @) c
靽摮source /etc/profile 扯嚗
* x% V9 m! X& r' H+ e* }$ Wmysql -uroot mysql> SET PASSWORD = PASSWORD('root');
6 ~; W/ L' a' }8 e0 I/ X( y/ ^2 g) |# g: P
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
1 n! O* h2 ]' x' ^$ ]; n% kmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
% @3 x) [ i9 h$ \# R. ^#./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嚗 " M, G7 e( Q. R* A
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
4 h* @4 |& q4 ? @+ c
2 m; f0 t$ w1 u _! z; ~rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm* V/ {4 D& e" b: o2 ^
Create /etc/yum.repos.d/php-fpm.repo file and add:
6 D5 _4 b4 q4 U- [nginx]
: Z6 D/ I7 }" Z$ ^' C - name=nginx repo/ A, m- n9 ]4 y9 D' K8 n5 M
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/3 b7 M5 H' i) |% a/ }
- gpgcheck=0' D: u' p: V" p9 c
- enabled=1
銴鋆賭誨蝣
/ c: P( B8 |4 s: N5 Cyum --enablerepo=remi,remi-test install php-fpm5 ~0 Y( H, V d9 E. X$ R, f
8 A9 b# Q0 i& w4 V
/ J _% `4 a0 L7 c& ^# Z鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn6 q. I9 S3 X1 z9 j3 F8 ?
嚗yum remove subversion //貉蝸雿祉svn
" B3 b; o5 K& T, c! O9 z, J # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
* z! ~ X7 I5 }) H8 d: x 餈# 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], o9 I# m3 V! D
# harry = harryssecret0 i, u# X5 q% |' x0 d- O6 T
# sally = sallyssecret
) S- u7 r1 G1 J; G3 i! ~& Xwangning=wangning# ]( z# L, I1 ~/ S9 [% f, I
yanzi=yanzi+ R& u/ ^2 N# \: \
#vim authz //霈曄蔭 0 E, x8 [' w5 O4 W4 S
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
8 I: t. ~: z3 lauth-access = write
5 J' U8 t) y" k### The password-db option controls the location of the password4 Z- b8 P' X' q) R5 G
### database file. Unless you specify a path starting with a /,$ O- V6 c# ?# J! v) @+ V" T& |
### the file's location is relative to the directory containing" h9 P1 Z1 G. t% [4 b+ C: K5 s
### this configuration file.
& Y7 a- S6 ]! O: u) B### If SASL is enabled (see below), this file will NOT be used.0 e+ V, x5 m3 p3 v
### Uncomment the line below to use the default password file., m8 Y! J) v9 s0 G# L. y8 D
password-db = passwd
7 `, t- v$ ^7 Q' n; W9 v### The authz-db option controls the location of the authorization& k8 \5 p% B+ q4 n
### rules for path-based access control. Unless you specify a path
[0 \9 w. M7 I### starting with a /, the file's location is relative to the the- l4 y, K6 g9 r, I" X, m7 w, F
### directory containing this file. If you don't specify an
3 o2 N7 T0 P. w! E N' ]$ L4 D& g### authz-db, no path-based access control is done.6 O8 T( j0 r4 ?$ H2 [" X- Y
### Uncomment the line below to use the default authorization file. r- S# j* t, E9 r( P
authz-db = authz( _( |, ~1 y; k1 v; g
### This option specifies the authentication realm of the repository.- y9 n6 Q9 W8 E5 U5 `
### If two repositories have the same authentication realm, they should3 i. f! d7 r6 a: Z' D. u
### have the same password database, and vice versa. The default realm& ?2 M8 X% m8 C2 T
### is repository's uuid.
; j% h: c; Q" i- k0 m! w* F: C* K: Qrealm = My First Repository% r; B5 P w# m$ C8 T# z' r
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
) M* z' i! z" }4 A. s' j4 L #killall svnserve //甇
) V. E, }4 M) }# g: W+ o( J6 D 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx) l b, K2 n* o e! Y" J( J
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 w. ^8 F! C- m: h& ]
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 8 W# ^( P( l8 \/ f# {6 @* R
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" :# K& e9 b4 x4 Q/ Y9 o" U% o, l
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
, n% |0 X" {5 j8 [7 S瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled / u1 r1 y m% l1 x0 i
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
9 J* F+ c) h- P% J$ {& X2 S, i$ l b% D0 t |