: http://blog.csdn.net/yanzi1225627/article/details/491236595 e+ B$ N- P% K( }6 b
/ F* k; x( y' `/ [& 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+ o1 l) Y4 Z4 K' m& K& q
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx- s* F" U; l/ R7 c& D4 f
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www; v1 }$ ^0 h4 W1 c) C* j& n
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx2 j3 d" S; S) K9 C
6 x9 p( T4 |; Y3 I9 Y" Q x9 F& qchkconfig --add nginx
5 c6 P5 y9 L1 K+ c q% }
1 x+ J X2 P+ @5 E. O; l+ zchkconfig nginx on
# p4 `! g( s: O- U 嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
6 a3 Z: D& L( r; k# nginx Startup script for the Nginx HTTP Server% m$ Y7 p1 l6 a# z, e
# it is v.0.0.2 version.
' K" F, d" h0 e5 d# chkconfig: - 85 15
7 c& L6 W6 n) V, A' w& e4 a& ?# ]2 y1 M5 l# description: Nginx is a high-performance web and proxy server.7 a9 v- e- R+ J' ?* H( n- K, X1 J
# It has a lot of features, but it's not for everyone.* k, ~9 }3 S, C- i9 B
# processname: nginx
' v, Y& q8 Y! L8 _$ B) d4 u# pidfile: /var/run/nginx.pid
6 ^% x) {! i5 \+ _# config: /usr/local/nginx/conf/nginx.conf
) p. g; G% }2 F/ |% s* Q( y2 u1 N3 Ynginxd=/www/nginx/sbin/nginx" j* r3 ?- r0 t9 R/ Q P9 P
nginx_config=/www/nginx/conf/nginx.conf
# \, g/ c2 `' D# f4 h t1 L. \nginx_pid=/www/nginx/logs/nginx.pid
! `3 ]7 I) n$ F, F( x0 V/ j& s6 bRETVAL=0
/ G) p/ l; _- J! z/ zprog="nginx" _" V0 l, D7 h) J5 D2 N
# Source function library.3 e0 c; Z6 k; o% L; Y9 p: W9 k
. /etc/rc.d/init.d/functions
- R! S+ W* p/ ]5 a* j2 Z" G* m# W1 s# Source networking configuration.
6 d7 \' w: j8 I& k. /etc/sysconfig/network
w& v' F5 j. ]& H7 o9 @) b# Check that networking is up.
2 S3 r- K$ Y9 m3 x' o[ ${NETWORKING} = "no" ] && exit 02 V2 ^8 Y- E9 p2 o6 a, Z' b' q! L
[ -x $nginxd ] || exit 0
: P0 G' G* u0 \1 _9 r: p( D# Start nginx daemons functions.( Z# z$ F! ~( G! y
start() {
0 `5 `: R h: M% h& P4 E6 bif [ -e $nginx_pid ];then" O5 f E( M" Z
echo "nginx already running...."/ A! z+ D& ?7 v" ?
exit 1
n3 t \# ~) A( Afi
7 x8 J T4 B6 I( H! k) uecho -n $"Starting $prog: ", x/ O: A# \% g
daemon $nginxd -c ${nginx_config}; t2 e6 x; W2 ]) N# L) l
RETVAL=$?0 C; G+ P# Y8 G% ~
echo
5 _- J( y1 G. w( P5 j, F. I[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx! n0 J5 g9 j# O( C" e, c8 z* C
return $RETVAL
8 ~0 W N' ]* T$ M}, m% ]. f7 f, E8 p p, m3 E$ s5 g
# Stop nginx daemons functions.
0 L* Z% i$ o. v, jstop() {
6 Y# t1 R% R1 _( q% \ recho -n $"Stopping $prog: "
. w! u F0 A. {: R7 Ekillproc $nginxd* l! P! v5 P8 E8 E; N
RETVAL=$?& o+ c, `" ^" F. H% n& d) g, }
echo
3 W! c+ p: I8 @7 a5 P+ f; L[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
, }" F' t: n( F: n}
6 U7 k! L2 H! ]# n3 E8 {, c! F2 e- q @reload() {
, W( J; x$ g. W J" l# Eecho -n $"Reloading $prog: " m& i% B1 {2 K
#kill -HUP `cat ${nginx_pid}`' f# d3 A& }$ j
killproc $nginxd -HUP2 ~9 g& v' Z* n
RETVAL=$?
+ L" ~# S7 L6 S% V2 X( Y- `1 Yecho' r6 y3 a. J& P1 X1 p3 u
}
3 n" S N) F+ s% \/ i1 D# See how we were called.
' C5 _6 k* F- q7 T! ccase "$1" in
& A# i$ }6 ]! Q' x6 y, Mstart)" `7 w$ w: E, q/ W9 \3 }
start7 k0 }5 z4 [- B4 p1 ]; s& Y
;;( a5 K, L- ]1 E" [9 [! Z4 e$ g/ v8 t
stop)
9 D' F/ G: X* o9 e* W( xstop
% e: K6 `+ ]* j! \* A% n/ @& p* c;;- m2 b1 j& m1 P) S4 E
reload)
- d3 [( s1 [" j2 d7 |reload
, a. G( ^. C' v" ~& _& [, C, o' M;;8 g! |9 K2 t8 ]/ L4 c/ e
restart)
! y3 U! [% P% A0 K$ i: [, Ustop
- X% F, e d) \- i4 K2 k9 x, mstart% U1 }3 g& s2 L/ E
;;
, S# A: c" M0 a. istatus)# i# r2 A1 |+ h/ B) ^% n) r$ F
status $prog$ L9 Q) d3 G& s# P
RETVAL=$?
8 |) k! T6 b5 a' r2 u f;;
& t; q% I8 E9 b: g! j5 }5 ?*)
# O# Z5 p; ~) q5 ^& Techo $"Usage: $prog {start|stop|restart|reload|status|help}"
1 G# t6 ] n" f% {exit 1: @. b% g$ t: b& B |" F# v5 i' i4 T
esac
- i3 ?% e5 _# a4 G1 h1 k$ Jexit $RETVAL% ]' A$ v9 \! f- M" i
1 T- v5 a6 i& R0 S2 e/ J 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 5 {" ]3 H1 L& L' Z0 O! D2 [
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗, {! i: P) w( T2 g7 w
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
5 I, p! {) k* j$ L location / {7 {9 F' g. p$ W( |1 m( V
root html;
3 j" T, E/ e* m# y! C+ i index index.php index.html index.htm;! l0 B0 a# n, T! r9 x
}4 P T C6 f2 w- X3 l
靽格嫣蛹嚗
2 j1 G1 j' p) u
7 Z e: h5 k) X$ z. m. v9 W; i location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 8 x4 l) ]* r3 ~" U1 b6 d
location ~ \.php$ {
& K& N6 r; Y( g" s* t- Z root html;
- n" e& j5 ~! H' {$ ~, u i: Y fastcgi_pass 127.0.0.1:9000;
. `9 `+ K* K8 T, | fastcgi_index index.php;
, k/ E+ S2 a. x1 M" l# f' q fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;: J6 g5 a" ~' o* X: Q- ^" G
include fastcgi_params;
- D# |; T) z5 `( |$ _ }+ F+ R2 _: ~3 j1 v6 E7 L2 q
靽格嫣蛹嚗
+ c! U6 {- P6 K+ _5 p/ @2 @' [. u$ Z+ T/ L# c! 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閫蝻拙僎餈唳桀嚗扯嚗
t: N, z' ^0 X#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
3 v3 x2 u: c. d. J# ^& F& h4 M0 l! F' D, Z$ @
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏' F1 C# a6 r) L [
扯 cat /etc/passwd 亦冽瑕銵
( M2 ^. p1 l Rcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
+ o5 w" ~' V" p6 K) l8 {* i 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
% E5 Z8 s; F3 D( t. I 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
1 I+ Z/ ?. c3 ], W5 a6 Cchkconfig mysql on3 o& w; Q: {6 F8 B/ ?0 s" T2 t
service mysql start --臬決ySQL
; a" j a: o4 z8 \* w: ^0 U' _ 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH8 z3 _! l5 \8 S4 g& `
export PATH
: _ s; G( O/ ^2 U2 \ 靽摮source /etc/profile 扯嚗 }, g4 j V# X
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
# w( ?9 m; w# u; p0 \6 t6 ~1 \5 `1 R: P/ T7 D
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 ' |" A9 S7 D- t% V! b
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
1 a' p* U, S# p1 Q4 | a% {$ X#./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嚗
+ i( E! N; S6 \/ x6 ]) ~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. u; d3 X! C0 d
! N! X/ s. [' T4 o7 Frpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
2 F& f2 Y; p) {, ~& |: `Create /etc/yum.repos.d/php-fpm.repo file and add:+ I# @. N* Z. u9 ?
- [nginx]
$ D; ]6 X: `! I2 b( H - name=nginx repo
8 X# N( f J( ]9 o- T - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/0 o! Q7 l2 [3 |0 G
- gpgcheck=0
6 _) W/ _* }) |* a+ Q - enabled=1
銴鋆賭誨蝣
! [2 f, R3 w7 O; w- n* byum --enablerepo=remi,remi-test install php-fpm
$ v# r, f: Y, j- ~
2 v% ]6 w" b9 p4 |) t
7 D2 B& E7 X4 s鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn& i" @- W& O4 q5 Y# Q- X! N( C: l
嚗yum remove subversion //貉蝸雿祉svn
8 C h9 ?. E# ~- p # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn" H1 V. j' f' G9 k+ ^5 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]& ^9 d8 ~. }& ^0 r* d) |
# harry = harryssecret
- @7 m1 K: ]' f: k# sally = sallyssecret( M- [' ?8 S1 t+ b4 f& f# E
wangning=wangning
I7 T+ N4 M! B& v6 |yanzi=yanzi
* s( E. t5 u- P #vim authz //霈曄蔭 % F3 i; F7 R, }; z, U
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none% a: R {# |& a8 L; ]1 L8 `# ~5 w. J
auth-access = write' r7 ?* Y0 B" J# s
### The password-db option controls the location of the password
/ Z( _. \0 Q( r* e: W: n### database file. Unless you specify a path starting with a /,
: d) q7 t% Y. y' P ~1 \### the file's location is relative to the directory containing" U$ r; l5 F) p) f# ]+ {3 X
### this configuration file.- }* M. [8 u+ m F: A) u: t! j
### If SASL is enabled (see below), this file will NOT be used.+ t7 C+ s- { g H/ A
### Uncomment the line below to use the default password file.4 `" K, G$ ]4 J1 D3 P, q
password-db = passwd, _' a1 X1 @1 m8 Z
### The authz-db option controls the location of the authorization
( I/ X4 X! ?1 b- k. X+ v### rules for path-based access control. Unless you specify a path
3 ]7 d9 t6 E% o* K$ [### starting with a /, the file's location is relative to the the. q/ L& D, v& L% w. z7 m. n
### directory containing this file. If you don't specify an/ S6 @6 f& _$ k" v0 i
### authz-db, no path-based access control is done.
' t, D- u+ R8 z### Uncomment the line below to use the default authorization file.
+ ?+ B, v0 V! v9 _authz-db = authz( y" \2 S& _% d0 I( G: R, y
### This option specifies the authentication realm of the repository., R: H; W6 D- i. Q, B3 D% Z
### If two repositories have the same authentication realm, they should8 M! ~; o8 i/ u8 k# \3 N- K7 R; G
### have the same password database, and vice versa. The default realm' C! d, z( h6 o
### is repository's uuid.5 S, S% X, l- W! ^" a" u) f
realm = My First Repository! e0 v2 c3 X1 _& e
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
7 z% n$ r. ]3 ^8 C8 V/ I #killall svnserve //甇5 _1 c; A6 v( j- F$ R
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx2 Q, i& ~4 E- y- i+ {0 m
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
" J% _4 W! a, P* v% [8 C/ b b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 $ Y) w, d6 h! W/ E% Y
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" :
% W) e0 Q/ u& ~& i#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 ! t- r' f% X- j/ G9 m8 v& ], P
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled ' H1 T8 I, D" o% t" i& E
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
5 m) [! |( J& U6 J1 Z' N! Z |