: http://blog.csdn.net/yanzi1225627/article/details/49123659- v% g4 M+ j b: d: |
5 Z" Z- O" @9 ?& Q格嚗剖遣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
0 b0 E2 H( A, `+ S# c. h 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx) p& b+ v. X1 x0 i; s& M
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www6 P. D _5 j: N- Q- M
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
1 Q# y% ~" `: B2 r5 v9 I# q* P" F" z2 G! ?" ]
chkconfig --add nginx5 _9 x3 \- E0 s) P
7 }/ c2 p9 G# D' F. o- ^" l% M! U- zchkconfig nginx on0 U) ?- A" d1 L, T- z
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
* I% J' x4 T4 H( p w# N8 n# nginx Startup script for the Nginx HTTP Server0 ?( ~" @. m' A# X7 G
# it is v.0.0.2 version.
4 z& c! k) b/ N! ?+ t# f, N# chkconfig: - 85 15+ y( Q4 J4 x- D+ ^7 m9 z$ W- `
# description: Nginx is a high-performance web and proxy server.7 d( p6 ?3 u/ n& A
# It has a lot of features, but it's not for everyone./ b. T) Y4 \4 C c) X% x. g1 z
# processname: nginx
6 v( G Z/ U5 n/ X& x- f3 h) c# pidfile: /var/run/nginx.pid* r* H4 a5 |! F- x( n7 \5 L# [
# config: /usr/local/nginx/conf/nginx.conf
0 M3 i. P+ `; x" X- Ynginxd=/www/nginx/sbin/nginx1 v3 q% u" u" @ ?0 b# q
nginx_config=/www/nginx/conf/nginx.conf ?6 I! C/ T7 B
nginx_pid=/www/nginx/logs/nginx.pid3 p1 q/ y# o, L* o
RETVAL=02 M& J" R1 a' u# O/ ~' n- x' m
prog="nginx"& R% @: E; }2 V
# Source function library.
. s6 ]1 W D& s2 O0 f4 T6 v. /etc/rc.d/init.d/functions+ t/ S$ u# p, I! ?
# Source networking configuration.( q( T% f+ S2 D0 @8 z( N# s% t! G
. /etc/sysconfig/network! K5 n- Z4 q9 |( h4 M5 f W& B
# Check that networking is up.
+ R+ ?( A6 T1 j. {5 M' N( l[ ${NETWORKING} = "no" ] && exit 02 F. ^, `: q) d% @' C8 t V
[ -x $nginxd ] || exit 02 l5 X) M6 z# k5 ^9 B. ^* b
# Start nginx daemons functions.+ \6 F2 _4 M- m& M9 d8 L. k- V
start() {+ E/ k+ A9 L" j; v( G& }& S
if [ -e $nginx_pid ];then
1 G1 T; ~. }7 ]9 mecho "nginx already running....") [- z4 R8 H) y$ Y
exit 1 Q* \+ f0 K0 H; t
fi
; O, j8 f: U5 r6 Q K. l9 lecho -n $"Starting $prog: "0 K1 I& ^; c0 ?/ s5 R% f' h/ [6 h
daemon $nginxd -c ${nginx_config}
; R/ X7 t- G. ~6 o. hRETVAL=$?
& [( F9 W7 t( o3 h. S( necho- L+ L6 S) H4 K8 C0 }' ^) D
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
( J0 Z/ i; G+ V/ m! {6 }return $RETVAL }) t: l2 N0 s1 Q5 ~- t
}
+ ^$ @9 n4 ~5 q4 K) c0 \, ^# Stop nginx daemons functions.
& u: m0 ]1 ]/ U5 T9 Y* Wstop() {# H, O7 N. u' _7 s! x. V8 U0 I1 r
echo -n $"Stopping $prog: "
% g! Z1 W* f% U9 H+ k8 G( H; `2 o" vkillproc $nginxd
8 l* b9 ~4 Q& m* k" RRETVAL=$?( [& _" K" P" Y3 U# q6 f1 F# ^
echo
* G$ R# |4 }' c/ b/ @4 [[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
* o3 r! Q" q+ N. Z) D: ]}
3 m6 s& G! X8 S2 Treload() {
, T1 @1 A( ^7 l/ necho -n $"Reloading $prog: " C7 V$ h* p* r3 g' e( N% o, s
#kill -HUP `cat ${nginx_pid}`
4 r# G* \3 o% }, bkillproc $nginxd -HUP
1 j7 l# q* w: j: [2 u4 H1 D8 b4 l" NRETVAL=$?4 q: h5 Q4 q. U; t/ v6 |7 e5 Z
echo
$ b; n7 w! K. m* P E$ z}
2 g* A7 _, Q5 ^! d( f0 s X0 M# See how we were called.
5 P, x: Y. @5 J2 H! a! Y3 Hcase "$1" in
2 u! r, e! b( e: z1 z; L) _: B4 Jstart)
0 Q0 y9 b2 c0 @6 Zstart
# y- g; B8 G/ o3 J;;
# N" Y1 }8 P A; ystop)
3 a3 z" J) j' w% m1 wstop
+ s, N" M; l4 \;;7 G4 s: e$ V3 L
reload). G1 X) M* w. v4 h; s4 N8 {' z$ r/ v2 d
reload
/ D6 e- m6 W9 y0 L. V;;# Y$ {. q# ]% A; V3 c# v
restart)
4 E0 y) t3 Q, h9 ^. ^stop
9 a. E$ ~1 ?8 c l4 F% t7 Mstart; r9 f$ X8 `+ U: J8 F' X
;;/ Y0 u( l" Q* V. x- u; @
status), e) Y- p; z$ O N+ g& n
status $prog
: {* g7 z; @# I9 aRETVAL=$?) I; o1 h$ E. v2 q6 j9 N4 V& h0 h
;;: F4 b5 A9 Z2 @
*)0 K% F/ z! ^* S1 a+ v2 Q+ C
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
- \: @+ X" x( _: Y# ^exit 1
2 _! m: s. c+ L3 k0 eesac
8 |4 V# ~- r" U! cexit $RETVAL
: x7 e0 I) ?- X) x9 P' f4 g
W! D s- @' n# k& u 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
* T. u6 A; ~' bchmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗6 t' U- S* \( v
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
0 |4 [; p$ |/ L8 a7 |) l) q# \" i" q# @ location / {
* U0 P5 P6 r9 q0 Z: g root html;
# W2 y0 e+ o3 G* D4 |4 I index index.php index.html index.htm;3 S3 X9 y9 j4 d" ^5 j& p' \
}
' |8 k. Z2 I4 }# l' m$ _, X靽格嫣蛹嚗+ S5 u, u/ M: j$ m! B" @
; p9 V% [: V6 O: [6 a
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 5 H; w5 P* i8 K
location ~ \.php$ {
- b7 D5 h5 I/ T- o- c" Q root html;
4 j' k1 d8 {( v; c* x" \9 G* t- V7 W9 X/ q fastcgi_pass 127.0.0.1:9000;0 ?9 F2 ^0 ]3 ~; j
fastcgi_index index.php;% j/ k' l7 c9 J6 |# F; U
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
3 L) `, C) E# y' q! f5 k0 [: z$ g include fastcgi_params;9 f0 t0 w1 P/ A% F
}
- S( i" N( |" \0 w% A5 p; u靽格嫣蛹嚗
* Q, s6 D6 e; q: k- M6 i1 S- {
) h7 ~5 X. B* j1 Y% k' u; e 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閫蝻拙僎餈唳桀嚗扯嚗 ' T8 W/ K( p7 L" D! D
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
( y7 I& k5 O$ O. b! |
5 I! D# q% |; d3 R$ `#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏' z* k( Y* n# U* Y
扯 cat /etc/passwd 亦冽瑕銵- ?/ i7 Y$ w# L1 e, l2 p2 q* H
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
2 w2 |1 w2 S# t9 s 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql, m {3 E. a- k) L
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql- l. { U$ c2 b" A& F" [0 @
chkconfig mysql on c) A% m- G& y4 C6 W( T& Y' d$ ^
service mysql start --臬決ySQL
5 L5 c& x& H% g" K1 s% K 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
" S# t) K: J- P$ h8 G$ ] M' xexport PATH8 r: ~! l: U- B# x9 h# s2 b- Q
靽摮source /etc/profile 扯嚗 - r, u. q1 }! K$ x
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');' ~' a7 h9 v4 S0 i% ?
& m- l5 L* c' E% `) k霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
4 r: @. P R! C J$ Z4 W$ Jmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
% `8 O7 ^0 A8 u# h% O. v# x9 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嚗
) F# |4 ]% }5 a% x7 r( ~2 m( 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! J, ~0 V. r* I* {5 |
8 M5 w3 l z- x( s. K3 c& {# }
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm" ]$ u' O' [& Z& K
Create /etc/yum.repos.d/php-fpm.repo file and add:9 r1 ^5 o' W( x ?
- [nginx]
) J- s* y) [- d; s1 I - name=nginx repo
6 g: @, f3 _8 p' d( p - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ a. b' H, u; [2 V
- gpgcheck=0% k5 A" a; E; U1 C; {9 ?
- enabled=1
銴鋆賭誨蝣 + Q+ i" ?# Z- m* w' A
yum --enablerepo=remi,remi-test install php-fpm
7 Q; t8 H& u9 P0 \4 D8 p9 }7 {6 X) j
( C4 Z+ B1 n6 u" A鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
+ z! @5 Y: ^- |- J! r# n4 T3 l 嚗yum remove subversion //貉蝸雿祉svn2 \# k% _0 R$ r% K. y7 d- ]
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn, A. X4 w" R; ]. Z7 L
餈# 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]
' M4 z4 H; Q3 w# G2 k8 q3 t+ n2 b# harry = harryssecret1 z. x0 s+ U) M: T `
# sally = sallyssecret$ |$ K+ k" g3 N6 `9 M- J
wangning=wangning* ` F0 y! v* C6 L# Z
yanzi=yanzi. q8 v( K9 d: ]
#vim authz //霈曄蔭
1 D" w2 `0 {* A% l5 ?[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
P8 n- z! J. [% hauth-access = write
Z4 i/ Y4 A Y- Q+ }( o2 O& X### The password-db option controls the location of the password
# ~8 ?( ]7 p9 R' c. L### database file. Unless you specify a path starting with a /,
# a. Y% D- r9 x' a. p### the file's location is relative to the directory containing
. C; T; N, o* l& ^% g5 S) @/ c8 E### this configuration file." `9 I; v$ R0 {& C, C, P
### If SASL is enabled (see below), this file will NOT be used. G% e+ U3 ]3 \6 t, D
### Uncomment the line below to use the default password file.
/ g- A5 t8 f$ \password-db = passwd
* W. z& H, G* C& l3 d### The authz-db option controls the location of the authorization" y- M1 Y& S ^: U# d w1 J
### rules for path-based access control. Unless you specify a path" f, k0 T" c% F# N) p6 D
### starting with a /, the file's location is relative to the the
+ ]; L+ Y2 h6 }& N! T' b### directory containing this file. If you don't specify an
5 U+ m! X2 w: i- @, T; ?### authz-db, no path-based access control is done.5 ?, |0 g) D5 Q2 ~4 x
### Uncomment the line below to use the default authorization file.1 E: H1 B. B; n- g0 W& D. t
authz-db = authz
r: X1 \9 @0 @: q! X### This option specifies the authentication realm of the repository.
2 u3 W7 S1 `/ x" s6 }! j1 T6 n### If two repositories have the same authentication realm, they should
( c1 W1 ^, Z# P2 Q### have the same password database, and vice versa. The default realm
* I: N9 \9 v( ^5 r### is repository's uuid.
7 n! S |! G* g: {realm = My First Repository9 l, f; F( E8 p0 L
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
8 c' i3 Y9 [, S #killall svnserve //甇
j6 g# S* P4 S# W7 g: F 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
' d$ D1 A: |$ P/ r0 K& U 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( [2 R @( P2 j& x4 `, P" p
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
5 X4 W9 E5 f1 h" v5 _) ?: mexport 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" :
4 b* J1 S+ ~) Z7 g#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 7 Y3 F( Y$ F: a% c) u
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
4 t' P: K0 ~# V; J5 I6 Jvi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿# T, E* J9 h: n$ B7 C' E
|