: http://blog.csdn.net/yanzi1225627/article/details/49123659
2 b3 I3 u# B4 [7 T
/ T4 t3 f8 L0 c格嚗剖遣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* y4 P5 ?8 C- }, E
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx$ m3 I+ A( _- O% U$ `
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www: C3 t9 \% O" I. M
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx3 l/ T6 g- T7 I6 l/ c6 @: w
7 y- p# c0 s& [" [chkconfig --add nginx
' ^; A" r: o% A+ M8 s O* g4 ~, t: j
chkconfig nginx on% ^& y/ g- C1 `4 z
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash3 Y4 J3 S% {& ^7 _/ H" V9 F( D" j& F$ r
# nginx Startup script for the Nginx HTTP Server
: K8 n- f1 z9 f# I. ^5 r) S# it is v.0.0.2 version.( s3 H; s6 b& K$ s' m6 E0 y
# chkconfig: - 85 15) F# O$ B$ U+ V$ `
# description: Nginx is a high-performance web and proxy server.' ]6 |3 N7 F9 W8 O& F9 M. M {
# It has a lot of features, but it's not for everyone.! K& u6 `7 L% j9 u f% i' w6 v4 }) A
# processname: nginx
) m% A/ o# S# ^: \" L# pidfile: /var/run/nginx.pid4 G# q7 B9 d& h- O
# config: /usr/local/nginx/conf/nginx.conf
2 {: j% U" s6 K( d/ C+ a5 vnginxd=/www/nginx/sbin/nginx- g0 a0 E! C9 s
nginx_config=/www/nginx/conf/nginx.conf6 ^) p1 `- D' q3 Q% s& m
nginx_pid=/www/nginx/logs/nginx.pid+ E0 K7 k, Q, g
RETVAL=0
. M! ]8 [' J% C/ H2 qprog="nginx"
" t6 Z& B2 z+ J/ ^; b: z# Source function library.
- k e3 W- o; I4 G. /etc/rc.d/init.d/functions5 b1 K1 a) A( r6 e" K, _ ]8 W
# Source networking configuration.
7 G! q/ W* d( I( f8 ?. /etc/sysconfig/network; @9 I: `+ G+ ?, I$ ^; e) G
# Check that networking is up.3 v k5 c* g1 f; n3 z
[ ${NETWORKING} = "no" ] && exit 0
! C1 @# N2 ?/ O[ -x $nginxd ] || exit 0
: E- C- B9 {/ d& b# Start nginx daemons functions.) ?! p! ?+ G, ]# G- r2 K& S# I
start() {
- E4 m# J" y/ O3 i) \( N& m j, g; {8 }if [ -e $nginx_pid ];then
7 ^3 S8 H6 \# Q% hecho "nginx already running...."
, |! B# U& K; oexit 15 o7 Z! E2 j8 X$ E. g) b
fi: O* Z2 y0 x# M# |+ e4 C0 x
echo -n $"Starting $prog: "2 V! N2 r! \7 v; a
daemon $nginxd -c ${nginx_config}0 p- w B C4 l& }
RETVAL=$?
3 d- k' S! H# ^+ zecho8 t2 u6 r9 z: `) }# O3 Q
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx k. Z8 J Y% M! M9 U/ @- q/ v; j
return $RETVAL
4 b2 c( [- a9 x5 g9 w3 W! A}7 L4 B+ }2 \# J( J ~8 v. C
# Stop nginx daemons functions.
/ v5 S. I1 E+ T) R' T# i$ Q' Cstop() {( K1 C0 C j; C; Z+ }2 Y
echo -n $"Stopping $prog: ", f9 A6 D. o1 _6 t" E j( @( X
killproc $nginxd
! Z! Z: p* c7 ZRETVAL=$?* J6 V: N# |9 w; |* Q1 w: j' H- Z
echo
, q& }& b' z" Y& J: p, r8 E[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid8 N& |- L" R9 t$ M- B; K3 j
}
# c9 K, y) b. m" qreload() {! w$ n& e) R9 u2 h9 ~5 _4 A5 u2 n4 e
echo -n $"Reloading $prog: "0 \1 d9 _% {) {. R# w
#kill -HUP `cat ${nginx_pid}`1 w/ E8 L# L% S! k- e
killproc $nginxd -HUP+ C' ]: P1 `5 r" ~( q+ j
RETVAL=$?
- \! L, B" S! e; M( F: i7 [echo/ b' ~0 ^7 {4 ^' l3 r( M
}. ~" I# K) V7 N* t: G9 R
# See how we were called.: l5 s) X/ t- j# u: w7 P D0 j
case "$1" in4 x* M$ W' d8 c0 @( x: H0 I
start)
! ^! g% d0 L, \& b+ T9 C6 Qstart
, I; ^2 h" G, O;;7 l" ?& _3 Z, B; P
stop)( \4 p( w R- T- s* f
stop/ k) T: D1 I# v5 w4 G5 z& Z
;;
$ y$ j& o. @/ F% breload)/ n* }) [7 y+ G# {( P
reload5 Q' e& r: s3 r! r9 g% ~
;;5 c6 `! e$ |7 n* z* c; Z5 {
restart)( {! T* l* x% q- ~- `0 O8 B. P
stop
0 {8 s# q( D; }9 g6 V; C2 D+ Wstart
& }7 Z& [; S+ L& o9 {;;2 ?" T4 P5 K: W7 R
status)6 o8 i# q5 r% T; {9 _
status $prog
) e7 B G; ] M" M% Z( U: vRETVAL=$?' p/ D8 q3 O6 ]! }" z) `4 p. W$ a( C
;;
) j& q W! H' Z: A0 R3 O% j*)
8 |( T, M: n; Z3 D" e1 }echo $"Usage: $prog {start|stop|restart|reload|status|help}"
+ S3 v s1 L8 j' Sexit 15 F2 z, k }, Y! ]& T) y) j
esac5 o5 j Q* \ S5 N j
exit $RETVAL! g. B" q" \4 ] w4 X- P+ Y
9 H1 G, F4 r) w n$ d
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 0 t6 t8 _3 N7 A H Z
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
7 M s% v0 N- \* b+ E. q1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 / e7 D M: H4 j- m* B* {' Q
location / { [, }# O! K. \7 V0 e* |0 u6 Q y0 K' s2 `
root html;" l5 W" m: q2 P4 }
index index.php index.html index.htm;# z, A8 O" |. g5 Z
}: h: Q6 ?6 p+ Q6 w& E3 X$ W7 n
靽格嫣蛹嚗4 z0 A9 ^( d. B4 Z
; w, ]6 o N+ j6 n' K location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 0 Z" V1 v( {7 W; l. M! l8 K6 m# \
location ~ \.php$ {9 F: q' q) I2 p1 W4 B! l3 b* @; ?
root html;
/ N. ]4 C4 v7 B S' X fastcgi_pass 127.0.0.1:9000;: ?( J: ^% l' D; l7 h
fastcgi_index index.php;7 f( o7 w' s E. D- b
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
% G' P' r# [8 Z: q0 I( b# \ include fastcgi_params;& l g* x4 o* S
}
% J$ Y# y) K/ R( y靽格嫣蛹嚗( w! h( R0 U) ?9 A
6 E6 V2 ]2 y/ A) d6 V6 M* 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閫蝻拙僎餈唳桀嚗扯嚗 * X h7 I. Z7 ~3 ^! }' N
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql6 ~7 C- E1 M% |0 [) z( D
% g3 E* G" ]) X* J0 {#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏
+ ?. q7 ~6 k" O9 q8 _/ s5 ^ 扯 cat /etc/passwd 亦冽瑕銵
5 @& ?! X0 H9 Vcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀0 |7 l5 v) o# M! Q9 s
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql1 B- A2 J& y `) m; D4 @$ f
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
5 o% x R% i: ]% r/ F. {chkconfig mysql on) c3 |% p3 e, B; I' ~
service mysql start --臬決ySQL
/ e3 [; P& o7 w3 H4 C3 D 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH6 e ]# K3 ]4 |- I4 W2 \9 D- H |
export PATH
: P1 X) x$ A: {3 x/ ?+ m& E% n" r/ I 靽摮source /etc/profile 扯嚗 2 ]% u6 [6 |3 V/ Y
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');3 }, h& } o1 o& V5 x: N
# @# Y1 l7 s0 U& E, b* y9 ]9 l
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
* G1 d) x$ z( ~! Q) T% R3 @$ qmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
6 c; D, P5 H! Z5 P; A& |2 x& y- `: I* k#./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嚗
. q$ a. z' D: z8 C+ s& ]5 MPATH=/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
% C( g' E5 a2 h/ {9 ^+ j( ~' M w$ q. a& R
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
0 G8 L: w9 _2 J6 a5 Q% }' G9 D" b) MCreate /etc/yum.repos.d/php-fpm.repo file and add:
1 R! c) t, g& p2 G0 h4 x- [nginx]: O" m, Q3 z t ]; X9 y
- name=nginx repo1 A# Y4 T+ w% D" b2 ~
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
0 u" E/ g! T4 A - gpgcheck=0
7 h& L. F% u# j8 ~! a. t! l" _ - enabled=1
銴鋆賭誨蝣 7 q; K4 c( X7 |1 r+ _8 ^
yum --enablerepo=remi,remi-test install php-fpm; u" w1 u& F+ i
: y) \+ b! w$ L9 s2 i: q% ^' H' J: x2 |: d
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
' G" ^( j6 ]/ Z2 O; G 嚗yum remove subversion //貉蝸雿祉svn2 `& [# l9 i8 _+ \! ]
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn2 s/ ?. e7 n3 E( Z% Q2 _0 y- @. m9 A
餈# 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]
0 q1 L0 q3 a" d: u- P. A7 b5 j# harry = harryssecret
; m3 r% }0 r% A8 z+ I# sally = sallyssecret
6 o2 t4 w6 l' W5 Gwangning=wangning' R+ D) U( S$ J0 W
yanzi=yanzi
- {, m: H- r' A! s( m) X1 C! G #vim authz //霈曄蔭
' ] d: f! [; S$ Z4 u[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
/ P4 D! D4 E: N7 s' ~& `/ nauth-access = write: x0 d7 s. `9 Z. g" V
### The password-db option controls the location of the password
3 u$ D( z4 t; l7 g### database file. Unless you specify a path starting with a /,% w4 ]! j- n7 d# \1 R
### the file's location is relative to the directory containing
3 |& ~' _+ V6 F; k### this configuration file.4 O9 @. X4 @% `
### If SASL is enabled (see below), this file will NOT be used.
" O8 s5 T. S! F9 _### Uncomment the line below to use the default password file.
@! T( R1 Y6 r! s- `% a0 Cpassword-db = passwd# m: w2 I5 \& @0 Q! J& V2 d
### The authz-db option controls the location of the authorization$ w0 M. U8 X/ M w0 S1 C0 C
### rules for path-based access control. Unless you specify a path
9 L" F8 `9 q- ?4 C, f W### starting with a /, the file's location is relative to the the: d) n$ s8 B' K/ Q3 P( R9 g) u
### directory containing this file. If you don't specify an4 L% J) V) a, k
### authz-db, no path-based access control is done.
5 w7 }, O1 u% s/ A### Uncomment the line below to use the default authorization file.
7 M5 n% x$ o9 R8 E- d8 D, J& tauthz-db = authz* X& i% [/ t+ ^" L6 j# r8 D
### This option specifies the authentication realm of the repository.
2 r6 f) ?, ~# Z; X. _### If two repositories have the same authentication realm, they should
7 _1 M$ j% f" h. ?4 |8 u0 n### have the same password database, and vice versa. The default realm
+ a [1 D. y/ e5 ]### is repository's uuid.+ r+ i* ~* l, F2 Z" w" @' @2 p/ E
realm = My First Repository
7 ~6 B" e# Z' u* D, _ 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
( E' ?0 w2 v; w. S5 M. L0 [) X #killall svnserve //甇5 d. Q3 }1 O6 v+ n
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx2 N$ J* W$ X* b( E7 ^
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% u: U: |9 n$ m3 ]/ g; t b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 3 Z0 @# q/ D5 I# z6 q$ {5 C. \7 N
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" :
1 b" n+ Z- [# A' ^#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
5 p" o* ]. Q9 O0 i) D瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
7 c6 U. F' u7 O7 Yvi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
# F" F$ P' x0 K; V |