: http://blog.csdn.net/yanzi1225627/article/details/49123659
# k, Q7 Z' V& X3 Z3 Z6 F2 P! { M5 I- z0 j0 k2 b' a
格嚗剖遣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 cmake7 f7 r% p# X, t' c0 ]
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
. ]9 a) P/ l5 L" D- {4 s 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www7 `! X+ x% q: Q6 s' _; P
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
& J* r9 `; `% A/ ^4 y% L: Z8 x# T0 \! \5 N5 \. d
chkconfig --add nginx* S- t2 K& K- c. f
, C: K! Q# b$ G: ^: f$ |* V$ Uchkconfig nginx on2 S E4 ^3 t/ {: L8 J* p# y6 W
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash& K" s, R( B T8 v; P9 j
# nginx Startup script for the Nginx HTTP Server
" m, Y2 p/ |* i# it is v.0.0.2 version.
" i, y0 j- l% M0 g# chkconfig: - 85 15
" s" t( r1 v! p) V4 |* c4 _( J9 J# description: Nginx is a high-performance web and proxy server.
+ C' W2 h4 a6 M# It has a lot of features, but it's not for everyone.! ^8 v5 D: I+ [/ G8 E
# processname: nginx$ F5 U2 O2 S8 \" K9 J# N
# pidfile: /var/run/nginx.pid
6 e. \* e7 p+ Y( e \1 q/ \# config: /usr/local/nginx/conf/nginx.conf6 A' L" V: ~; q& l* A
nginxd=/www/nginx/sbin/nginx
' s' {2 d* S! j! g+ U3 y' Enginx_config=/www/nginx/conf/nginx.conf8 T( L5 T5 H1 C4 I1 X+ U0 |2 N
nginx_pid=/www/nginx/logs/nginx.pid h& b9 r( `% ?& H0 p6 H% w+ W
RETVAL=0. N, }; A4 g& W' R" h2 i1 B0 |7 J
prog="nginx"- I' c, Q7 `( _% d( {! |
# Source function library.9 y5 _: |! w) |2 U; `" |0 z
. /etc/rc.d/init.d/functions% o3 T5 p( r: \
# Source networking configuration.; n) s' F2 F/ J2 a, |
. /etc/sysconfig/network: y7 C1 ~0 i8 X1 b) ~3 O7 [# Y9 r0 u
# Check that networking is up.
0 m9 h, A& E% s8 G6 |+ n[ ${NETWORKING} = "no" ] && exit 0" v0 I. ]3 s5 e+ H( F7 E
[ -x $nginxd ] || exit 0
5 G- |+ M: K! D" y1 h8 J# Start nginx daemons functions.5 K5 M9 B0 g* i8 ^6 j/ C0 }
start() {
) r8 @$ K+ h6 L/ Aif [ -e $nginx_pid ];then1 l6 |' e) s' r* A) `5 i/ m$ l
echo "nginx already running...."0 V' N5 W* T4 l7 f% n5 E
exit 1; ?1 R3 c/ a2 a
fi+ U, V, F6 i+ X# _0 S2 {" S
echo -n $"Starting $prog: "
$ {" W3 x$ e) F6 f1 V. g- F& Gdaemon $nginxd -c ${nginx_config}3 K# [. T8 w1 K! ~: Y" P1 n
RETVAL=$?
0 b5 N# b% K; s! i ^ z4 qecho# H2 H! U4 w9 b: o
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx& P6 }& S, X! K2 I
return $RETVAL
: `" Z7 \4 w$ l5 Y+ n1 G+ s8 V7 y}
`3 v4 ~; X p& }" k# Stop nginx daemons functions.
8 y0 c# k7 f7 `' ~# c% ]; {$ hstop() {* c/ S% p% m/ R0 I
echo -n $"Stopping $prog: "+ S$ s8 }8 @6 m
killproc $nginxd
5 v+ I& S" d1 Z7 L: ?RETVAL=$?/ @. ~6 k3 c3 G+ g$ x, o- v( ?
echo
& Y8 R3 Y$ Z4 F" V; `8 y, n[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
" o4 `6 K& d7 y( [5 G8 n+ V5 ]}
2 E) O H* S. \6 c xreload() {# n( N: S9 {" I0 h7 `
echo -n $"Reloading $prog: "2 C% ^; m0 @" t9 U9 _4 i9 Y* |
#kill -HUP `cat ${nginx_pid}`- @! i) }1 |/ @8 X2 Z$ P6 ^" x( d
killproc $nginxd -HUP& Q1 I( p; X* N4 ~
RETVAL=$?
9 E2 C6 V5 U) ?% W9 Lecho" K: C+ P# f/ W4 h9 m. T1 S/ W
}! E$ i" A; k, E/ W% f7 @
# See how we were called.
! V8 ]0 B+ B1 G; V. f0 Wcase "$1" in
5 N% y$ M# W. hstart)
+ [0 X: j9 i* G2 j7 v$ lstart
m8 n: Y' e" y0 D: n;;
- F0 z J+ o8 O h Q6 Q% \stop). l; ]( g5 g: M5 ]$ d# {
stop/ b" B; @5 b/ v2 f- Y3 E5 E
;;
# T P1 w% }4 W- r! w$ P8 Rreload)! |! H( [$ o" H2 s* f1 ^( M
reload* d, B, T1 g- _" }* d( P7 X
;;
* t, ]9 m$ I, ?& s& s1 e+ h8 B7 x0 t& L) Krestart)
' Z& b0 n( v# r5 _stop
& M/ k) K+ o9 J7 H5 Nstart6 Y1 ^2 T( w6 \, `' ]9 }
;;
/ l+ D( H6 X4 x0 ^. t* ?status)
. s$ J0 H! e& s% M5 F6 N- j: nstatus $prog
& c( s# n* N6 ?9 |/ b' @RETVAL=$?
0 B- R/ ~! ?+ ~+ h& m& L;;3 s* ^7 `+ W- b+ y
*)
9 E- [& D' I. v3 g/ j; E: _/ T$ L) J% \echo $"Usage: $prog {start|stop|restart|reload|status|help}"0 |7 d. N7 r" |) S( N
exit 1
; ]4 ?6 Q8 v; {) vesac, m8 I) f x. n) f2 @5 M% v1 x! _
exit $RETVAL, J3 K7 K- ~6 B. g7 ^
$ q8 H8 ~' h3 q 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
% e @ J# H# w4 U lchmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
4 ^7 F( z9 x6 D# u# J1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 0 Q3 _' x' j/ S2 y9 {( V
location / {! s$ F; n2 f# S) S
root html;/ Q3 L* y7 M* Q; K* _# U3 s2 K' [
index index.php index.html index.htm;5 Y. ]' n! n) j* w
}( X; g3 |- R9 {$ d: V. O
靽格嫣蛹嚗
$ H) h9 \: d. h8 r1 K5 J; a7 i- z7 ~) _
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
, Q& m- P8 }: a9 j: t' ^location ~ \.php$ {
4 g& d* Z6 I& c" L/ \5 x5 y root html;
4 X2 E8 ]% }) l4 X2 f7 F' } fastcgi_pass 127.0.0.1:9000;
, [ Y1 C" m' i, c fastcgi_index index.php;' y0 B9 s/ E9 U
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;8 |7 T. G: l: F) ^/ T: e7 {
include fastcgi_params;
. P7 G( A9 z9 W' f6 ` }
% X! K* b G4 b靽格嫣蛹嚗2 Q: H. X$ w; F8 i5 R2 }/ Y/ z7 R# ^
& u; b- [) n+ [. c' E q5 ] 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閫蝻拙僎餈唳桀嚗扯嚗
6 Q3 D$ i% t; Z( H# n7 h$ _#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql# }6 j. H# `& L
& P6 X& V+ k' _5 H! m4 B# N0 W( c
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏: s, V6 [; `* u* ]
扯 cat /etc/passwd 亦冽瑕銵
! q' |; M. J8 V$ j5 Fcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀4 G: k8 d2 E2 k) d
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
: N _0 e9 K( l" j3 m, ?, F) P% a5 w 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
/ m1 B& ~) o0 A1 a1 {1 Uchkconfig mysql on
" `$ `! i9 i0 Nservice mysql start --臬決ySQL1 C/ i" H1 }* _! d8 k5 R
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH4 b$ ~$ H+ O. u) b
export PATH
2 l. P9 B" c# [, p 靽摮source /etc/profile 扯嚗
; I9 ^& |' \' A- Y/ gmysql -uroot mysql> SET PASSWORD = PASSWORD('root');! \0 ~, | G. d, ^& L. ?% K" I
" G; h9 u; U8 v- r: s& c( W/ v
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
" `: g/ a4 G8 t4 b- |9 z% dmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 ) U6 n/ B: q2 Z, Q$ G
#./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 L2 l( T5 l- b4 }% G. ^
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- r) f4 T* ^2 w1 F2 j, J" N
Y w) P4 k0 Trpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
& r% ]" r3 v9 u5 s* ~* ECreate /etc/yum.repos.d/php-fpm.repo file and add:6 B: r l+ b# N' P g
- [nginx]4 Y4 }1 R' s8 E8 X
- name=nginx repo
# X1 _5 }, \% Z - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/! _4 j; S2 q7 J; `0 N" p
- gpgcheck=0" c1 M7 F3 K0 D9 W
- enabled=1
銴鋆賭誨蝣
8 ~. @1 A, b0 ?5 r3 L, p& ^. \4 lyum --enablerepo=remi,remi-test install php-fpm
# \) f8 Y/ y7 P9 _) H# [% V
& W4 g8 \- I) M1 Y
1 ]/ W; J. j* ], w& |- y t鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
( \0 ?' w r2 ^. A9 O 嚗yum remove subversion //貉蝸雿祉svn" H$ F* F2 I: W7 \ N
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn2 h4 k' V$ x [
餈# 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]! ~7 ]6 P z* ?
# harry = harryssecret
" r6 }9 ?0 `* {9 g) m$ d" `# sally = sallyssecret
' w% y/ W" X) O. T. A% Ywangning=wangning
( B$ g- a7 ?. ?" M; J: ]yanzi=yanzi7 y: A8 u2 z0 f0 d3 L# t3 s
#vim authz //霈曄蔭 6 W" @# h$ k8 a# [$ J% d
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none' I8 `, X$ `; E# Z/ h1 w& v
auth-access = write. _9 I0 H. g7 o. Y1 N e. X1 F) n. [
### The password-db option controls the location of the password) D& ]* d! Z6 @1 @8 z4 ~' V" {* l
### database file. Unless you specify a path starting with a /,
* z T, t) T6 r. d( M' n$ m### the file's location is relative to the directory containing
+ O+ \2 n8 m7 p### this configuration file.
! q9 @+ H5 J6 {" X9 c) L1 v### If SASL is enabled (see below), this file will NOT be used.
) f5 c6 |; X! W: d) U3 b### Uncomment the line below to use the default password file.
* N+ m# S: ]- C' m- xpassword-db = passwd
! h( z' {4 F' N### The authz-db option controls the location of the authorization
) O: R4 D! H; O+ O### rules for path-based access control. Unless you specify a path
$ Q2 ^5 f) ?# N6 ]3 Y- n/ i5 ?! C### starting with a /, the file's location is relative to the the
9 W) ^9 S0 N/ \# V1 J- L3 h8 l### directory containing this file. If you don't specify an
+ u2 b1 W( o5 U* {3 m! X5 G! m/ Y### authz-db, no path-based access control is done.
: I |) ]1 y/ q) \: I H( c### Uncomment the line below to use the default authorization file.
! t1 P. t, u! |& @( _4 j2 a- v# zauthz-db = authz
+ P0 C) m2 ^0 W) p* A% O* u### This option specifies the authentication realm of the repository.
% [3 a7 E% ~3 w1 P! X### If two repositories have the same authentication realm, they should
1 L `7 P' d! a7 ~5 ~### have the same password database, and vice versa. The default realm
' p# N' D# W, |+ ]8 S### is repository's uuid.
: d' m: C& V( P' |5 E* ?realm = My First Repository
- q9 [0 w; g8 p4 L 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn) y7 {- n8 O$ g* F' K0 ~
#killall svnserve //甇
! m: w6 E# |% S! e* v2 r 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
( m% ^$ \ h/ I4 y 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/web7 I. H. O j9 n9 r
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
& x+ m7 l1 n' p( y% ?6 P5 z& Zexport 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" :
! G, F4 S* q4 y1 z* ?) B+ l3 j3 F#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
+ t4 _* t6 j7 b0 E+ f* Z9 v5 C瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled 5 }/ \. x3 W6 J. A- w/ G8 K* j
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿& e+ p' }$ e9 m* b- O: o
|