: http://blog.csdn.net/yanzi1225627/article/details/49123659, D1 B: T5 O* {" k7 s2 S
5 n1 a( r! l" q+ Q( p
格嚗剖遣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
7 F ^( t2 q7 o6 Q8 n 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
+ f/ p, d3 S7 H) g# C/ H 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
2 V7 }; A" V5 w) W( T* ?, {3 L# s2 X/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
) {3 F, b; A. }, i9 S; k# W7 Y4 d' g! m9 ?. @
chkconfig --add nginx" ]: n/ a$ L7 c% q" C
* f& m2 T* e/ I7 Z8 N! bchkconfig nginx on4 I) a1 K6 P7 R* U$ Y
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
W3 b/ l2 q' T8 G# nginx Startup script for the Nginx HTTP Server" o9 a- d7 V* L# U. K; t
# it is v.0.0.2 version.
F8 C) q$ o9 G; E' _2 c# chkconfig: - 85 15/ d! V8 N( P N( h% r) ?6 T
# description: Nginx is a high-performance web and proxy server.
/ z0 g. s, v- x" U# It has a lot of features, but it's not for everyone.
) V( m9 U6 y8 `3 X8 S8 e# processname: nginx9 ~( a4 ]4 d5 y$ `6 v4 e
# pidfile: /var/run/nginx.pid4 `! `2 m% H8 S' e+ {: D% y
# config: /usr/local/nginx/conf/nginx.conf% n4 |& q2 a, @
nginxd=/www/nginx/sbin/nginx
& u4 i8 F$ R3 ^9 d4 J6 enginx_config=/www/nginx/conf/nginx.conf8 P; r$ l* W6 y, }
nginx_pid=/www/nginx/logs/nginx.pid( Z7 Q5 x- K! z) q! A
RETVAL=0" Y B: @1 }7 S$ n7 p/ `! v* K
prog="nginx"4 F! \; ]3 E3 L
# Source function library.$ w% {/ S, S9 I5 y! o( h
. /etc/rc.d/init.d/functions
& q3 H9 m( x5 g+ h; l( E. A1 ^8 ]3 F# Source networking configuration.
2 p( ]- b" s, ?' E! o. /etc/sysconfig/network2 j; x% Q6 H+ c: H
# Check that networking is up." `! f4 l- J4 `& v, {
[ ${NETWORKING} = "no" ] && exit 0
4 y4 P1 R! ?) h* o6 O8 z3 n1 \ c8 ?[ -x $nginxd ] || exit 0
; v! C& p* P* d) K% ?- M. U: c# Start nginx daemons functions.
/ |; E+ y( m+ [2 Q, A+ {start() {, E. w% I. n3 {6 e
if [ -e $nginx_pid ];then
1 e2 c% l8 d( Aecho "nginx already running...."
% x/ n/ I; c8 | [6 t1 lexit 12 z* k5 g1 t. Z% u) V! f
fi
1 P3 i# U4 J5 o2 b" f- F- v- ?6 K, ?$ n0 Necho -n $"Starting $prog: "
6 ]0 P, u- o( i9 A4 e: \1 Edaemon $nginxd -c ${nginx_config}7 [- K( B, U8 N% j
RETVAL=$?; b* H# j$ Y: W) l, t0 }! b% M
echo" D% l3 |; u2 r8 D d$ g
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx, B9 Q8 J9 h2 G# }; a9 s
return $RETVAL
2 d5 P6 R# } K8 I+ _1 [}
) [$ Z% K% _* J7 r# Stop nginx daemons functions.+ }) M4 c* b; C! I7 M
stop() {5 D) P5 W# K; t. w. f7 m- G8 `
echo -n $"Stopping $prog: "3 L0 N- k5 }/ t
killproc $nginxd
) Q6 f' V8 Q& N! H' ^' V8 E; ARETVAL=$?% c2 d M* q f) V; V
echo
4 I! p7 f( n. p- v- U& A/ M[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
8 y8 o5 d; N; N6 j}
; K' j( Q0 X3 m2 ~5 F! J% a. hreload() {# F: I* d3 t1 N i. _; x F7 H) V5 e
echo -n $"Reloading $prog: "
- H( X, n2 G( F- a. I1 T#kill -HUP `cat ${nginx_pid}`
+ ^2 Z2 M8 j; z) t1 p1 y# xkillproc $nginxd -HUP- D0 K" G- J* s R& N: s$ S$ r8 o% t
RETVAL=$?+ C+ B8 Z. E$ q( H5 P1 K ]
echo
3 b- r d0 p# _$ G; B}
: x1 r0 U, {6 q4 y) ~% g' ?# See how we were called.0 f; F% K/ D- O) O! O/ C
case "$1" in
4 K1 U5 m% _, I& L0 G9 _start)
! f1 G8 b n9 M, Kstart
9 d8 ^. @, n- a, J7 Z;;
5 T& z$ `; T) Hstop)0 e1 O, f9 N# Q
stop
% M# n) B# N- [4 k/ l) a1 n# |: N;;( @! V4 _+ ^! P4 M
reload)& R6 v* d3 |3 |1 {% d: n
reload
: I! ^5 X$ F: _9 ^* v: l: t;;7 n6 O+ v0 h8 j9 e# T: [& z! e
restart)9 N M4 @9 k4 R& _- Q
stop/ R- Z1 u6 { L4 a2 m; W
start
# X4 J- l, t$ s;;
+ K, [1 j Y8 @status)+ p; q9 ]- P1 u0 U6 [0 C7 a
status $prog
; Z5 I/ k) `3 Z+ |% Z4 h8 vRETVAL=$?
- g/ k8 O6 E$ \1 o+ {: [7 n8 ^: a;;$ w4 ~3 |6 M3 e, L: T- T
*): A+ x$ E. N7 ]2 v. N8 ?- G+ G
echo $"Usage: $prog {start|stop|restart|reload|status|help}". W: G. D# [- z% G
exit 1
# }" r3 N* S) e0 y* ^: iesac. L6 `0 r" ]: V1 B/ _
exit $RETVAL
- h4 ^9 j7 G v* k! u7 T
5 V8 l. D# h- Y 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
+ D+ y6 b, d/ i, k8 gchmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗" n) L! N/ _1 a3 R
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
9 O6 @! ~( v' \# G location / {3 H# z+ t" u6 D
root html;
* e' b/ H8 G- u: K1 ~6 O9 K2 f index index.php index.html index.htm;/ _* @0 P! ` p( z3 }+ L
}
* K. ~! \0 [1 f靽格嫣蛹嚗
0 ]0 @7 V4 e" l! l; W7 U" X. D
Q2 F5 ]& s) K* T/ ]: F location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 3 B# o9 \8 o4 U$ ^
location ~ \.php$ {
5 L7 ]( [" ~3 q9 O root html;: X' v2 D; t. E( \
fastcgi_pass 127.0.0.1:9000;
0 b/ ]; x- E) ~. I fastcgi_index index.php;
9 v. e y2 w' m, ` fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
. _. o _6 |7 ~* w; C- s3 t T include fastcgi_params;% i5 i b7 j- a3 B4 `6 L0 v
}
5 ~3 F& M6 F }+ X, j, c. b% Y靽格嫣蛹嚗
, m. L/ L% j" c/ }8 N( \1 i8 G# Z9 B/ T
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閫蝻拙僎餈唳桀嚗扯嚗
( W/ q9 g" p; v8 m#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql; h5 c: m# e9 R/ }: h+ e
: O) X! |% }; a6 M% @
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏' z7 m3 L* K6 [' @! w/ B1 Q! n" B) H) v
扯 cat /etc/passwd 亦冽瑕銵4 a, j/ S' m ?3 e; G7 I
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
3 w) W( K Z3 M) y) o 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
/ m: W W4 q1 r3 ` 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
( R1 J1 i& A7 q4 mchkconfig mysql on
% L( u0 }8 p7 o8 k7 I4 xservice mysql start --臬決ySQL4 b% p6 D- P" P7 z: p7 u$ a
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH. Z( H* n3 G$ n9 `& q9 w5 A. r
export PATH
* M; v5 L/ M1 |- S9 B8 p1 G3 V 靽摮source /etc/profile 扯嚗
1 C/ B4 { \3 {6 i' |2 F3 p, `7 ]mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
3 d2 c/ ]4 c: _+ t$ K% q6 K
) ]/ w, l8 w! X9 I- R% p1 M$ V; q霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 + v: p, K' p5 P
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
7 h' z' q* v- j. j, x, m% C#./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嚗
& _6 r# `) [; i: c0 JPATH=/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
. d% Y1 L1 O7 y; o( z6 v" R' }9 V5 y. Q
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
5 E6 ^7 x w2 r% z. PCreate /etc/yum.repos.d/php-fpm.repo file and add:- K8 m# R8 o, P- i* E; |
- [nginx]
+ Y' f* V" K5 j6 G4 R - name=nginx repo
+ a5 G$ I z# B" V7 w" g - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/% i0 u0 v4 q K9 P: D
- gpgcheck=0( `: i& T2 |5 r! a3 f" L/ i
- enabled=1
銴鋆賭誨蝣 $ _' E% e, e8 s" g$ G# |' C
yum --enablerepo=remi,remi-test install php-fpm/ |+ |5 N- L# B" E
" W4 r2 s5 I+ |' q
: e- F! u; N6 b4 Y鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
+ S- n7 i' N" D3 A 嚗yum remove subversion //貉蝸雿祉svn( x3 h2 v+ W& \& e% Z# Z
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
6 O& @ ?" q) [0 m7 K5 k- w 餈# 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]
$ ?8 y3 O) t2 L3 ~5 {# harry = harryssecret
/ o8 u1 T5 b5 A1 w3 c7 O) a# sally = sallyssecret
L* t4 L: C" A7 C" nwangning=wangning+ H9 o" k7 ^1 u( t
yanzi=yanzi
D1 ^% x# N: i9 |# q! s #vim authz //霈曄蔭 8 r ^& Y0 D4 W8 [! m) F
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none$ p, |; u) L. k0 w! O& w
auth-access = write
3 y5 Q7 a' }" m- `0 b% `5 q### The password-db option controls the location of the password" z+ t3 n1 D. x& M
### database file. Unless you specify a path starting with a /,
+ y* j$ k5 r. `. J/ u5 B### the file's location is relative to the directory containing: q7 D3 u' T* J! o y) h0 F) d
### this configuration file.( Q; C7 D5 u6 L
### If SASL is enabled (see below), this file will NOT be used.
! n1 Q: [% p: C+ Q) B: e### Uncomment the line below to use the default password file.
1 T( ~7 p, H. u# Y' I& h& ?( kpassword-db = passwd
: E6 y% g1 V: U& P- ~2 j### The authz-db option controls the location of the authorization+ g) _- U/ w \/ K
### rules for path-based access control. Unless you specify a path
% [; c2 x% y G/ c$ P### starting with a /, the file's location is relative to the the
5 J' H! M$ }9 J* n### directory containing this file. If you don't specify an' L1 o, I0 N( v
### authz-db, no path-based access control is done.. \% ]' W. R- H
### Uncomment the line below to use the default authorization file.( A' t, P# j: i
authz-db = authz
, c! c' Z2 s% F& z1 l1 |. D# I### This option specifies the authentication realm of the repository.
6 y3 h& f# P: {. t2 t2 \2 K### If two repositories have the same authentication realm, they should
" N" p- c W5 d7 G### have the same password database, and vice versa. The default realm
0 p, |* N0 i5 v8 h### is repository's uuid.
1 O% p7 {8 _# K6 Q0 ~realm = My First Repository
5 n. B9 C6 B9 t, y8 \: P6 O( g8 I6 w 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn, T6 |/ H& k# J9 l) H
#killall svnserve //甇$ {0 |" N( q/ n: s9 X
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx6 ~; {6 d. D. z; L7 E' H0 D! z
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
4 s7 h% b5 o9 Q4 `4 m1 L b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
7 l3 t/ N, E; Pexport 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" :! P4 c7 M4 r, s
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 # q- I1 t: [3 f% b' ~: M8 A
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled & W% C% U* A: t8 P
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿7 n5 Q& z1 [* E
|