: http://blog.csdn.net/yanzi1225627/article/details/491236597 Y9 p" J- O+ c# Q0 E
, F5 z1 |7 [: s" ]8 e! Z. L格嚗剖遣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
6 e: Z5 C3 j6 | 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx4 x% A$ G# w& S5 c+ e/ V+ N
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www: c) E; W6 U5 f- b/ E
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
( N0 J& |1 {. L8 @% ^5 m$ h4 ^3 `$ \4 U y9 w; |
chkconfig --add nginx j' o1 ^$ o8 o, n r
7 i/ t @" L& i( A* H0 N
chkconfig nginx on) i# E4 I% f/ X1 p1 ^
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash; W, a$ I$ T" F
# nginx Startup script for the Nginx HTTP Server/ V% h# z5 N, G5 a5 x) |4 r
# it is v.0.0.2 version.
& F; |; i& N- ]& \. ^; X# chkconfig: - 85 15+ A0 O1 e2 f+ t+ s2 p2 H
# description: Nginx is a high-performance web and proxy server.
( W5 }8 ~0 j7 @+ o7 Z* A7 X& f& }# It has a lot of features, but it's not for everyone.) W. _7 R# A2 y3 N
# processname: nginx2 S z! r; l1 y* _+ M$ B# `4 X( a- Q
# pidfile: /var/run/nginx.pid, q; W- |3 z. T9 }* g
# config: /usr/local/nginx/conf/nginx.conf4 n7 Q+ \1 C9 o8 E3 ^& ^! } n
nginxd=/www/nginx/sbin/nginx
: w9 B4 n* Q) R% n) v- r. B1 D+ y: {4 anginx_config=/www/nginx/conf/nginx.conf7 C7 N3 h+ L2 w
nginx_pid=/www/nginx/logs/nginx.pid
" h- U" {7 k; M4 j; ~! x- `RETVAL=0! p7 X* o E0 A/ r1 E; ^
prog="nginx"5 z/ q. C2 n! N+ k) Y' ^2 x
# Source function library.6 S3 M' _& c/ M
. /etc/rc.d/init.d/functions1 j! T& J* D& S. o+ @2 Z' A5 q
# Source networking configuration.
5 E$ e% E2 T7 k. /etc/sysconfig/network; e# j5 c. Y: q) T& |
# Check that networking is up.! h, M" H( s9 s1 @
[ ${NETWORKING} = "no" ] && exit 0* ~& v' t' d. T" R5 d3 g' r/ \
[ -x $nginxd ] || exit 0+ E$ ~# j. }+ N& D/ W
# Start nginx daemons functions.3 b |* i5 g) d- E9 U1 U' c
start() {" j3 d4 j; R" N/ E* k/ m) J
if [ -e $nginx_pid ];then
' j7 {) K; N5 h/ ^* d0 c" Necho "nginx already running...."
$ {: K a1 _1 p6 j Sexit 1! ?( f& C5 H9 g9 S3 {. [% _ @
fi
6 ?8 j' s$ F M E, L% oecho -n $"Starting $prog: "2 ^, m$ g( c+ G- s8 k$ _8 h4 s& u
daemon $nginxd -c ${nginx_config}
. w6 Z# l! `1 T) P( g7 X1 Y8 KRETVAL=$?/ j8 C4 A( X. o+ K1 X v
echo" ^. b6 h8 n+ | Z: D4 N- ^4 `
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx/ I0 Z" ]) H2 Q! ?$ A: U+ O
return $RETVAL
z; F9 _5 ?/ C. i& j5 c}: Z" C% J6 a! ] j- K
# Stop nginx daemons functions.
# \* g# G$ j6 [' V. n+ Fstop() {5 U( S$ t5 R2 ^3 C- e! t
echo -n $"Stopping $prog: "
6 s @1 [% W% ?1 G3 U& N$ F" T- Nkillproc $nginxd
" u X U7 i+ n: ]( L4 J: tRETVAL=$?
2 n6 q8 L" W2 i' Secho1 N* X5 [- D5 g; [! Y; J
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
0 r( @; B% P- g4 t& y+ ]+ i; X}: H' F6 s4 t) D4 l" E/ K/ ?* Z
reload() {; m3 r- b6 x6 b
echo -n $"Reloading $prog: "; |* i! q4 O7 D( h7 n2 \
#kill -HUP `cat ${nginx_pid}`( r+ c* F$ }! {, ?; l# W% C
killproc $nginxd -HUP
$ B- Y7 T+ D" jRETVAL=$?% k0 Z8 L! Y) F! {3 B7 \- b$ o
echo
: a/ ^4 H& y: f9 n+ c# R}
; O5 c1 i8 }& B# See how we were called.
5 d; q1 m: F2 x' Lcase "$1" in$ X' }6 H9 [! b0 l1 e
start); G) ^4 }- H1 q3 H6 Y! M2 p+ w; A
start5 R' j2 ^" @3 P; s* s& [4 s) d
;;
1 W/ @; K6 b0 E# astop)
0 G8 A$ a$ Z+ K; l. F. L& Gstop
. ?3 Y# N7 V% U. z V;;
, j* E5 {% U# a' S# `reload)
: \# E. G9 H2 B% w4 breload
3 T+ u! X: X+ M" ?! y4 G2 a& T;;* {$ W; C9 y$ `4 M
restart)
0 a* x& f7 @) _/ g/ R W& ]6 Xstop
. D4 M/ x7 l1 d3 Zstart
: F/ J& I8 J; c( a;;" v ^' L9 u3 m5 @5 s" a3 y
status)
0 c2 z3 B \' Y% E. l6 |2 xstatus $prog
" H; z8 Q! u& r: B ^% sRETVAL=$?
" \' ?, `1 j! o. g) r& e;;
* V8 ]$ i( i) A9 z( }1 y*)- j5 d5 y) i1 v" ^8 k$ V0 M; L
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
, d# i( f j/ r Nexit 1* p/ u9 h, |; Q: \% f' \
esac
6 _* g5 S% H* N7 {) Dexit $RETVAL/ l, Z/ o; `! Z' M
8 J9 z' W7 _" G; y 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
[4 f$ X" |. T6 echmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗2 ~% {" H( p2 K0 ~3 Y) _3 o7 M
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 2 _1 O7 Z% t* B0 [, \3 l
location / {+ w' L% p* G9 @/ b
root html;+ f) ~7 p, d+ B8 U, i% K
index index.php index.html index.htm;
, {0 g1 ~7 E& V$ F' m! ^ }* W; P( ]/ N) X6 y7 f/ ]6 N0 n; e9 P
靽格嫣蛹嚗$ w) J# K! ?) ?9 C& G
2 i% D. R X2 ` location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
, b, }; A% r0 n- B Hlocation ~ \.php$ {3 c) v4 o- _9 V8 X4 s
root html;
! ~$ Q: w0 p ~( g fastcgi_pass 127.0.0.1:9000;5 L) c* @1 M- \! {
fastcgi_index index.php;9 H8 T7 i O. G, ^% f
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;* b) A) j9 M) q/ a+ ?! w0 h
include fastcgi_params;
- Y' @# K2 s4 P) u# d+ ]) Y# d }
6 g1 v6 P" q, f6 x2 c* a- ]) [靽格嫣蛹嚗
a( h) P7 R3 D: K) l4 y. x$ e( E k- G6 u7 e# q5 L+ P/ f' W: r1 k
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; ^( U) W) p! v/ k9 P, k" P#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
) _0 [. \2 n- G3 U9 P b' ] g
5 g! k. I3 z* `#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏
9 Y+ x0 k3 v0 Q; F$ g" k 扯 cat /etc/passwd 亦冽瑕銵
+ y( e+ x8 z3 r; Y; kcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀6 Z) \ m l/ Q8 Y# l$ d! V2 i( l
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql8 q) W, L( x/ q* ^
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql/ _/ n9 W' v2 K' h$ R
chkconfig mysql on
, R _" n3 O& l* A2 `$ Wservice mysql start --臬決ySQL. |; O- w% i8 z. b7 j
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH( N: ~( S+ D3 K {
export PATH
, {) E8 J/ a0 ^% d4 M8 g- T 靽摮source /etc/profile 扯嚗
' P. K2 Z# Y& N: B# W: Zmysql -uroot mysql> SET PASSWORD = PASSWORD('root');: q0 v* T" g8 g7 }- n
3 b6 [: \% T7 N* G+ Z霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 & U! U) w! [) Q+ ~7 c. v
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 1 ]3 C: @% x+ m$ I0 F( n
#./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嚗 + u, |; k1 O9 u4 V2 k/ K' X
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
/ E& q. z/ Y# T: q0 r) {+ D# T' X" Z6 p- a; D' Z4 ]% c
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm: x6 I* p$ e1 x; I
Create /etc/yum.repos.d/php-fpm.repo file and add:
& z: L1 i$ n! }4 S+ z# T- [nginx]
% o* F, y) l& D# n. m# q - name=nginx repo3 D4 w2 g: T, k6 P0 @/ o
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/+ Q7 Q6 h9 c* Z
- gpgcheck=0! V& `4 d( ?- m9 u' T1 ~8 q- [
- enabled=1
銴鋆賭誨蝣
. y K& L; b* i2 m# m" k3 C3 Byum --enablerepo=remi,remi-test install php-fpm5 \3 Y1 z+ A8 c; }: t
6 b' t } f5 P2 `& A
8 \0 `2 B; \! N" Q" x: L鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn4 L0 d& e8 G9 a4 K& V" B
嚗yum remove subversion //貉蝸雿祉svn9 Z0 ?4 g; i( n2 t& F+ b8 y# k
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
& m. z5 H; T8 K! ^ 餈# 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]. y6 ^+ m8 ~2 N
# harry = harryssecret
% q5 j9 t4 t! @! w2 x1 \' q# sally = sallyssecret
- B" i: R/ }: k, x2 d+ [+ M. awangning=wangning! A# c9 C% t* _# Z7 M. X6 ~7 t
yanzi=yanzi
! w* _8 Q' ^. b# \+ m2 b8 T #vim authz //霈曄蔭
$ m1 o! [" g/ A. p4 U/ l[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
8 Z- M5 r# `4 K6 H& e; ?auth-access = write
6 @% U6 s* E* H; N. y0 R) N### The password-db option controls the location of the password
; G+ W h: M+ b. ~: [5 [### database file. Unless you specify a path starting with a /,4 |( Y- r- t& _, ^/ v+ }/ X/ a
### the file's location is relative to the directory containing
9 T! n6 p! }; S: ~9 N### this configuration file.
# \/ }) O+ N1 J1 `. o0 e### If SASL is enabled (see below), this file will NOT be used.
8 ]" Z6 i! a+ q, |( K### Uncomment the line below to use the default password file.
+ N. | Q, ?' k0 j6 t kpassword-db = passwd
, n- A1 i' R# r0 X7 @: ~! Z) ]### The authz-db option controls the location of the authorization. C0 b" C9 F$ H8 n) l+ x: s5 k; I8 H' J
### rules for path-based access control. Unless you specify a path, z5 B; P3 h+ d* V: {, z$ ~+ K9 D
### starting with a /, the file's location is relative to the the: o8 n* q7 F6 w5 o# [, j, i: P4 k* D
### directory containing this file. If you don't specify an+ U" |' A/ i( P4 s% @5 {+ s" Q. }) d$ h
### authz-db, no path-based access control is done.! q; Z: Q1 e' }* z. D" ]2 _
### Uncomment the line below to use the default authorization file.
( @7 L4 k9 W. G# Kauthz-db = authz
% r: C0 R( h* u+ Z7 l; {2 T$ T4 O### This option specifies the authentication realm of the repository.) M# C$ s# c" c+ E7 V+ V
### If two repositories have the same authentication realm, they should
. W% }; J+ c( r### have the same password database, and vice versa. The default realm
: f7 H8 y) Z& ~5 T" b### is repository's uuid.0 Y2 ]3 ?' l" F+ ?+ _4 r: w* G
realm = My First Repository( K4 Z, h; `8 Z3 i# o" o" H( m
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
& |- q1 @4 W) n# s! g5 h #killall svnserve //甇
) P/ F/ @) Q' o, X' H3 _. Y- H 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx& i& f' [$ G2 m
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
8 w4 x2 c7 s6 S" b b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 5 V. X/ y; }+ R; `4 I3 o8 c" y" U
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" :
2 \) g2 ]! t/ b* ~#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
6 d0 G) f$ ]1 x, W5 Y; U( m瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
2 ^ W- y! m" t3 m6 ^vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
7 D0 N1 f4 Z8 N/ b& I0 c8 H$ f |