: http://blog.csdn.net/yanzi1225627/article/details/491236592 p! d* {. l$ j9 f8 {0 y
4 |( d! Z2 H$ ?0 z/ \格嚗剖遣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
3 X) i, |9 f2 m# Z9 h3 X, o 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx Q3 u2 P, W- n, J2 T% p: _8 S
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www {% P5 ?' {5 V# i! I
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
; ]" y- c1 \! U3 \
2 f% U$ k+ p1 Hchkconfig --add nginx0 W5 L a; ^9 t, D
5 J4 N0 L) p7 I' \6 [) Vchkconfig nginx on
& \' Z! q0 X1 @! j, g5 d 嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash% A) T6 k+ y6 L5 ]" k8 e
# nginx Startup script for the Nginx HTTP Server2 H; ?" y) V6 }: E( [- n6 u8 ]3 ^
# it is v.0.0.2 version.
* W& c2 }9 B) ]# chkconfig: - 85 15
7 g; E( h+ f6 B# description: Nginx is a high-performance web and proxy server.
. u7 m4 d9 G5 ]6 L( i# It has a lot of features, but it's not for everyone.5 H" h3 ~3 Z* `% F
# processname: nginx
8 C* {7 G1 y# h5 Q9 `# pidfile: /var/run/nginx.pid
9 y, S. D! Q7 S; p4 f: r& a5 e# config: /usr/local/nginx/conf/nginx.conf
$ | o* a/ O' }' {nginxd=/www/nginx/sbin/nginx
! }9 {7 ^' C0 v/ {nginx_config=/www/nginx/conf/nginx.conf
$ ~ l' n9 S9 Z( A* Ynginx_pid=/www/nginx/logs/nginx.pid
* Z6 f" f% ~* G1 \* @8 j( TRETVAL=0
+ }: r: S5 M$ ^4 A7 fprog="nginx"
9 Q2 c l0 n" X1 D; q2 h# Source function library.
) O5 i6 n# r2 e& V6 X- Q. /etc/rc.d/init.d/functions$ u' |/ L' e3 \" p; \
# Source networking configuration.) n# J( T6 A( P+ ~. B# d
. /etc/sysconfig/network2 W# k0 t4 `+ s, t, p; a
# Check that networking is up.
, s: ^; I" N. n( \/ \, O[ ${NETWORKING} = "no" ] && exit 02 s( Q1 ]9 d. w1 T. X
[ -x $nginxd ] || exit 0
7 D0 o! |/ u! b& I2 P# Start nginx daemons functions.* y2 s F3 F% Z6 c
start() {
3 E, c% h2 g' x) p3 Uif [ -e $nginx_pid ];then; X, r. e1 h+ G! G% I# a
echo "nginx already running...."
9 Q, Q& n1 C' ^/ Q5 H. H8 R. Q. a; ~exit 1. I+ f1 i& d/ S! E
fi o8 t, S# t! a7 o, Y8 W
echo -n $"Starting $prog: "* d8 ]9 h" C8 z+ m. l& e0 d
daemon $nginxd -c ${nginx_config}, L A4 k) [, Z% S# `! U S
RETVAL=$?, j3 ]) L) s8 B/ e6 M
echo4 l& w e3 u1 G2 x( Q7 l
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
3 W) d5 H7 A8 ]: I8 q9 Mreturn $RETVAL
2 \: c% H9 w' v$ x: @9 a}
& c; ~* u0 |% g3 [+ q# Stop nginx daemons functions.; w9 w2 r; u7 ?5 R
stop() {
9 w$ x$ A0 ]" e5 b8 J& l: {. kecho -n $"Stopping $prog: "
& I% T. ]: P1 ^0 q+ @# rkillproc $nginxd
; n+ \4 T' y5 T( b+ wRETVAL=$?2 X3 @5 [8 _4 J' K
echo
) E. A2 K( |0 ]: D, T9 g5 ?[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid d9 J0 W$ L$ H0 r+ d
}9 _/ e2 k) r: n0 O$ o7 r$ J; z
reload() {
! k2 D) S7 K1 D q" c. P. Pecho -n $"Reloading $prog: "
5 u5 F% W6 M6 `" l2 ?( i# F- D#kill -HUP `cat ${nginx_pid}`
2 z: u% f s4 W# h1 |& S Bkillproc $nginxd -HUP
6 `6 W# Q% y4 m& X: uRETVAL=$?
) E1 [! a5 G8 n# J$ [* K) U+ recho
# s. D1 i2 `& j; Q" ~- y/ B$ _. V}) n& c5 o8 N1 W9 w+ X5 M% l
# See how we were called." w( l7 ?' ]# V5 {
case "$1" in: J! o8 }! ]" J L
start)' u; {5 b. x% _) l8 B, G
start
" A) u4 O6 R) p8 W& z0 {) _;;
, R$ _9 v1 [; ~; g$ D* z1 H) Cstop)
1 e( L; p0 L) Y- a8 H4 C" P1 J$ wstop
- u; _5 T6 P( ^, h2 a;;
; |( h( ]: q$ F$ b, f4 a& a7 ]2 Creload)
2 p" b- N- E* U ]reload I" P/ ]. Y8 w& ~
;;$ F1 |7 v( g' p- b% r8 U
restart)
0 P: d6 M: O; E* b s; cstop
' O6 V( N8 B, G! q$ S' A# F2 Hstart
0 X/ r- O/ }* e+ W8 u# i;;
: }7 J1 P; b* Y! rstatus)8 z0 Q: y6 i3 Z- \4 s r/ ~
status $prog
" N) |; v% n, ~: IRETVAL=$?
4 w) ^ Z d4 j0 l;;
' \& m3 O5 X$ B1 k9 G K: K*)6 T; D3 t1 d+ z- t
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
* x7 y- K5 q: [! Z% a/ Wexit 1
- C' X, F! k3 F6 x1 P+ D) qesac- x7 m; ^1 I* f4 Q# r% m
exit $RETVAL
- F; ^: t8 D2 Q) l
- s) [) b5 V9 Z- n7 L 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
4 O( f+ K$ o; Y; U! Gchmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
; A7 g: G; g, o/ D7 g* x1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
% Q1 g5 ~2 d4 n T) w6 x( I location / { \3 ^4 H3 v! e Q2 E
root html;) O& P+ f9 }. ^6 h- L# u
index index.php index.html index.htm;6 V# }5 O5 o& G
}
$ [- c O1 L8 g* o靽格嫣蛹嚗# O7 u. ~6 e u1 E6 B- l
6 J: T; ^, |) o$ V2 i location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
W E$ b: \* b; Q# a4 k Ylocation ~ \.php$ {& E) l0 c$ N% p( r7 I
root html;
; f7 q$ @/ ^( u Z5 P$ \1 f2 p* i fastcgi_pass 127.0.0.1:9000;2 T0 Q& I- t& r+ k8 ?
fastcgi_index index.php;! D6 x* i1 W7 }- J$ F" }4 v
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
. m% n1 H: Z* V* u5 C include fastcgi_params;
& f( Y+ @$ m$ f# @ }$ w3 a) L! }- q7 ^1 d4 S
靽格嫣蛹嚗) l7 Z' u; _5 u. t/ R
) c' Y" Z; R2 u) ~7 B8 y( 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閫蝻拙僎餈唳桀嚗扯嚗
* _0 {; R& X* _6 o; O; @6 y- r#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
& C8 D& T3 i. _/ O+ C' O& i7 X( ]; [- D& _
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏1 R4 e$ I8 I9 ~1 Z/ p1 @
扯 cat /etc/passwd 亦冽瑕銵
7 u9 ]6 O+ g6 w6 {2 h) {cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
+ |4 |. n9 E- V+ K; c 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
) A' Q9 q! [) L8 C 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql& t! |& Z2 }( u- L* U
chkconfig mysql on$ a* @1 t' m y" L% V( s: w: c2 n
service mysql start --臬決ySQL4 A" y+ k: x1 y: u3 y
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
% p! b6 f7 I, |& Texport PATH
' @; S' s6 _% ^7 w 靽摮source /etc/profile 扯嚗 : R D' i7 w6 Q2 Q/ r! l
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
) l, h! h# } S6 u* {5 w( D9 W8 t5 I5 o
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 ! }$ X) p( |1 t
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
* t* M a8 W' W4 \7 k3 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嚗
. V8 x. I0 _- J- X" cPATH=/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
5 `& H' m7 P- H- K) t _9 P
/ {- L# X$ p7 b1 {$ Qrpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
% t4 |0 I( K+ J, g9 dCreate /etc/yum.repos.d/php-fpm.repo file and add:& b- c& N" p% T# F9 c& U ?5 N
- [nginx]- {$ {/ p/ N9 E; s9 L
- name=nginx repo- Y! g( S. _% J0 |! j9 r7 v
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
/ E* g0 O" v0 T# f$ O+ _7 z- l6 C, n& _ - gpgcheck=0
. c+ |- l) V5 C) q& A - enabled=1
銴鋆賭誨蝣
6 T; r. n; l- v2 F2 u" @yum --enablerepo=remi,remi-test install php-fpm
7 ]7 X; i, w# x3 x, s7 m9 S0 {7 Z) {( U( {
$ D& J5 h( ?2 E5 B$ p5 {
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
. ]8 p" i! x# r- ]' [: Z 嚗yum remove subversion //貉蝸雿祉svn
" |5 N2 Z. ~7 B1 E. e U1 U# k( W # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn8 x5 Z3 S! u: o, b
餈# 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]
" M2 S- W1 R, H0 t# harry = harryssecret. d; x/ |/ m& k4 X5 u+ T8 ^
# sally = sallyssecret
8 `6 l' _% f0 uwangning=wangning
7 G# V. T! Y7 | z/ Iyanzi=yanzi
9 Q/ d4 |2 \+ o9 ]4 @9 f3 T, j7 Z #vim authz //霈曄蔭 5 P" [" ~# B: `# }$ a" B$ F8 r
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
1 g9 H4 m$ @3 K! jauth-access = write
) M( k$ v. f. H- }- I! e: m0 d### The password-db option controls the location of the password( B* a% I; R e% M* X' [
### database file. Unless you specify a path starting with a /,
( n! a, w7 B4 [. N- E0 s### the file's location is relative to the directory containing
' |) j$ ^# R x/ p; F, S### this configuration file.
$ ^) W9 t0 I" {9 R! t. E### If SASL is enabled (see below), this file will NOT be used.' B( B& `4 w; e
### Uncomment the line below to use the default password file.. Z- N- L* y2 j) D: w' j f5 R
password-db = passwd2 j# T2 U$ d& [! @5 ]
### The authz-db option controls the location of the authorization$ V$ w: ~& B, v: [( U
### rules for path-based access control. Unless you specify a path
- Z w8 Y; q% n### starting with a /, the file's location is relative to the the
$ e. B' k* `0 C4 K### directory containing this file. If you don't specify an, Y/ `9 `' @& h0 ]# i6 n
### authz-db, no path-based access control is done.6 y$ `% ^; P3 f- g4 Y
### Uncomment the line below to use the default authorization file.
' d1 W. Q |) w0 G1 L2 oauthz-db = authz
" c/ S0 r; K7 s2 c3 Z### This option specifies the authentication realm of the repository.$ s& S7 h7 g8 ^
### If two repositories have the same authentication realm, they should3 a9 h% N+ v# L9 |
### have the same password database, and vice versa. The default realm; O7 {( Z# w( R) U' v1 P2 p/ ~
### is repository's uuid.
2 j% M F" ~8 m0 W% W% q" a6 hrealm = My First Repository% C% a' T9 |, H, h
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn- O) i( J1 D' L- q' l$ Q6 y$ K* z$ _
#killall svnserve //甇
8 t* e* x: {1 H- ^ z# ~ 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx/ N' X+ I B3 u% ^) Y8 k0 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* F" j y U: H b5 y/ u, W( Z
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 & n% q* [9 u7 I; g# ~
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 V6 [; j) ]* F; q6 `# K; a#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
' i( E9 f2 K* C瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled 3 X" X7 m. v9 }0 a. l
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
5 n5 e( q% }# P( I |