: http://blog.csdn.net/yanzi1225627/article/details/49123659& U3 m6 \* `& E+ j6 h
0 V. @. c$ ~. F% S+ q" }* m
格嚗剖遣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
" [" E' T3 Y, C. M- A7 a 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
3 d4 w4 U2 a; V, c/ |5 I& q 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
. e9 k$ s" d6 f/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx v# A5 v9 T7 u% N! a9 t$ X
/ l% f# ~* {+ M& ?# g" K
chkconfig --add nginx
! P7 P8 q. r! q+ I( u5 S' w w; ]1 c' o3 L8 J
chkconfig nginx on# f& ? b+ `, }4 G
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
# G7 p0 V7 ?1 a5 ^( E# nginx Startup script for the Nginx HTTP Server& `( P% ~3 k& E3 g
# it is v.0.0.2 version.: X' m) k- r: }: f0 }( s" g
# chkconfig: - 85 15
v& z( O. u& H6 M# description: Nginx is a high-performance web and proxy server.
8 b5 r1 k, D0 z# It has a lot of features, but it's not for everyone.# m1 Q& p8 A# b g# C
# processname: nginx6 R7 H/ q. O: q" Q# l" I% G, h5 F
# pidfile: /var/run/nginx.pid9 ]# \+ |2 @# }6 J7 ~: U
# config: /usr/local/nginx/conf/nginx.conf
; y5 R( X* B% fnginxd=/www/nginx/sbin/nginx
" `' u# W1 d2 v0 p, D9 ~9 }7 h/ Gnginx_config=/www/nginx/conf/nginx.conf- l" c1 g- |2 G, t! O
nginx_pid=/www/nginx/logs/nginx.pid
$ o+ x) {6 b* {& N8 qRETVAL=0
' F7 f# ^% j& @ t& `prog="nginx"5 N) X. Z8 Q& F3 i1 g/ ?: F
# Source function library.
) k& Q5 n6 t* ]0 d+ D7 b6 }6 h. /etc/rc.d/init.d/functions
. t( }$ r @# O- i2 H% E. \# Source networking configuration.5 T% G0 b; o$ g: E& f
. /etc/sysconfig/network# b" N. x" v2 d: V
# Check that networking is up.
+ t* `: [. y+ A7 i[ ${NETWORKING} = "no" ] && exit 06 W; c/ a. s- z% `, z
[ -x $nginxd ] || exit 0
# i# ~# \6 j+ Y* n9 A3 R, v# Start nginx daemons functions.6 q, w" D, W: Y" F! s
start() {* l# ^( q. f0 t: X
if [ -e $nginx_pid ];then* K7 ]" a1 E( I- G0 [' r. c! `
echo "nginx already running...."
/ w( K' A/ U2 dexit 1
$ C0 F, N# C( F- Vfi
, m) c6 w" _% W$ M+ _8 E0 _echo -n $"Starting $prog: " x3 h1 U& e' ?. W) d3 u
daemon $nginxd -c ${nginx_config}
( q. u' o, U6 @& l1 u( MRETVAL=$?# p2 D9 C/ R/ n6 Q* O* z
echo
- t) I' I% |/ ]; R& r) [[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
0 r. r3 b# l- C) b& breturn $RETVAL% e. W9 |- l% `* ~9 V' D: X
}' i& e- _" U' n; ` E
# Stop nginx daemons functions.; [; J1 Q/ L2 r! _$ D' d
stop() {( D1 Q6 D" n2 e/ B+ G9 M
echo -n $"Stopping $prog: "; Z j' y! w" |
killproc $nginxd: a& q a! u# g4 J6 [( _2 L: n
RETVAL=$?
7 n4 h" r1 ?; a* L( l8 Techo" g5 k8 g& a6 T2 i
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid" w7 n2 n) x; A4 y& h1 |* Q
} [( W7 M. ^/ i7 Q' F
reload() {2 f' [( n7 Q7 s* _, _
echo -n $"Reloading $prog: "
5 z+ x7 H1 s# g1 _- [* @#kill -HUP `cat ${nginx_pid}`3 [5 h9 m; ]5 ?" b. R
killproc $nginxd -HUP; J; g9 l4 G4 ]8 h! Z
RETVAL=$?
) i4 o, }" T3 d2 J1 Jecho
5 ~4 B! H" k% {( a4 W6 ?3 h}/ k- v' N, V7 z0 k% o0 O' V
# See how we were called.& Q5 G) Z h9 U- }3 [
case "$1" in, F% Z9 ]( E, z' {+ e
start)5 }3 h! U" _. n9 n6 N
start
2 c m8 _2 t0 K- H;;
& a3 e# e# s" R |' w' z$ C$ k, hstop)
% h: z# L0 [/ [) y% xstop
; k2 @) g, j: k4 m;;
: E, W1 i8 \( ?reload)
$ Y7 k: Q, ^" z1 L3 ereload1 k: ~, V y1 U5 V$ R: F
;;* |( G8 x6 V5 v7 P( F
restart)6 A( w$ k% n+ E6 O/ B
stop
* w, j5 b: v. h' b; Lstart1 o H1 M3 M+ ^; M7 N
;;
$ j4 Y" B$ r9 B/ Pstatus). ^, v; U2 T; K+ }) ]
status $prog
5 w2 ^3 S B. r. W* N! ]% o9 n8 C. h) LRETVAL=$?
" I1 N1 u2 c5 n! {;;( ^9 v0 Y b% [5 t
*)
1 t0 O2 ~* @+ F! Wecho $"Usage: $prog {start|stop|restart|reload|status|help}"
- ~; p7 b2 G5 o$ J0 A/ j4 d. Oexit 1) a, t) ~ P8 ^) ]
esac
" A3 @1 q6 Y; j( w" Q9 {exit $RETVAL4 S! ]5 P/ B# _- t( N8 H) S
& N2 B. v" |( @8 p/ V3 A3 F 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 0 A' y% [0 D4 G, K7 u
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗7 o4 A) f, R8 y' D& M6 S8 ~0 l
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
# U- q6 e$ \" P location / {; R+ a3 E( r, ~. E: H
root html;
# K# X4 l+ k+ [3 Y+ H: h" ? index index.php index.html index.htm;/ X9 r, ~; R! l( q. n
}! }0 C+ S9 W/ P' B" W8 O% _2 E5 @3 O9 p
靽格嫣蛹嚗' Y4 B3 a2 a$ B( z
) N9 ]! B+ c& g location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 ) b& A( M$ h9 K0 N+ F* }$ V# e
location ~ \.php$ {
3 }- B6 n( M9 x2 A. b& D root html;4 d ^3 ]3 z; M# ?; G }
fastcgi_pass 127.0.0.1:9000;7 N) Y: a, O9 ^ d+ D1 d' e
fastcgi_index index.php;, q& { `6 W. d/ V2 F G5 l8 X' r! X# U
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ J/ C/ t0 P1 y9 @( | include fastcgi_params;
h1 y+ A) L+ m' Q) G }3 o; [( J% i+ Q% v; ]7 r) ^
靽格嫣蛹嚗
4 r5 @7 {& j2 x# ?- B0 |' i9 i, j& r9 g( C6 ?. r3 J. 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閫蝻拙僎餈唳桀嚗扯嚗
- p0 L7 R$ j; D/ Y#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql1 }+ F1 g3 H! G9 G6 l, h$ s, d' M: O
7 j3 I: }: N; t+ h; ^, [$ [
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏+ L% n; N! \2 T$ B
扯 cat /etc/passwd 亦冽瑕銵
2 S9 _$ w1 Z. u$ I3 C5 Lcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀2 W. @ ~7 q" L5 y7 Z
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql6 K2 r6 F0 ^% x9 S& p
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
7 g5 h& x* R$ tchkconfig mysql on
1 N7 e9 h3 J& [- O, zservice mysql start --臬決ySQL
8 C% j; n( B4 K) D; v( K 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH C3 ~: P. R$ e6 T, A8 U
export PATH$ A7 M. E' K( g2 e0 C0 v2 M F6 K$ G
靽摮source /etc/profile 扯嚗
& R$ g: A; w& N9 @5 G: t" [mysql -uroot mysql> SET PASSWORD = PASSWORD('root');( l4 h2 b3 Z; V: `4 H
) f+ s+ o$ ?( k霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 " [4 E, L; {3 C$ y
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
9 h/ E. o, J* b- f#./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嚗 1 C& a/ F& a, d$ 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
A- C) D' S# `* o- X
4 X: l+ e5 R$ r' |) Orpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm3 d/ o, R3 I6 N' s- z
Create /etc/yum.repos.d/php-fpm.repo file and add:
1 k$ D( I* _3 W8 O- [nginx]
3 N2 c6 F# o; n1 b - name=nginx repo
% s' l. |: F( l F# H - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
; H$ N: k: b& i# M - gpgcheck=00 c U7 \" ^* f6 [. h
- enabled=1
銴鋆賭誨蝣
, n" Y! Z u: Q3 ^0 T: ayum --enablerepo=remi,remi-test install php-fpm# S! F0 h/ P! C8 a
& B7 T; B4 L% V$ b8 q0 y
U; z; K( t. }, w8 {
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
; S3 e. d( r& V& q. o- f5 k 嚗yum remove subversion //貉蝸雿祉svn
1 W" D! b2 l9 b" D$ l8 [! s # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn3 k5 x. ^7 p+ ^5 E. m2 ?
餈# 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]8 w g1 ^) o' B2 e& E9 b# Z1 v
# harry = harryssecret
+ K+ J G# k3 W4 W |# sally = sallyssecret$ D; e h o3 b/ P8 H
wangning=wangning; L4 p# v2 P! N1 H N
yanzi=yanzi
6 v# D5 Z6 y& A* x1 a# S #vim authz //霈曄蔭 1 D3 {; A5 `; x, k
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none3 `2 d( l% _/ Z# J; H
auth-access = write
- L/ j0 m- {3 G$ w6 y/ |, G### The password-db option controls the location of the password
. n7 N* l I+ a/ T/ h9 l9 k### database file. Unless you specify a path starting with a /,4 R+ C; ?! T1 i( j: g
### the file's location is relative to the directory containing
! C: P. M+ e9 ?+ r1 u1 _& \/ g- I$ G### this configuration file.: ^- r" Q( b" ~- I3 c
### If SASL is enabled (see below), this file will NOT be used.
( P+ \5 Z- ~" X8 @### Uncomment the line below to use the default password file.
% l& ~9 n" A- o$ c8 b# {password-db = passwd
0 g7 m! u3 f( _+ s9 `8 w### The authz-db option controls the location of the authorization! {" G# w4 D4 j( b( g( X6 W4 K
### rules for path-based access control. Unless you specify a path) @: y7 A2 }3 t) O' f
### starting with a /, the file's location is relative to the the
2 x) p8 p3 O4 m# X; A! o### directory containing this file. If you don't specify an
' o# ^/ O% s1 F- J2 Y: G! A% S### authz-db, no path-based access control is done.+ k# Z' A* I7 x, y- _9 m5 B8 P
### Uncomment the line below to use the default authorization file.( G0 L d/ q- t" f- _
authz-db = authz
& _, f& B% C) C) w### This option specifies the authentication realm of the repository." g5 ]2 ]4 d1 x1 ~+ ]% e e4 a5 @
### If two repositories have the same authentication realm, they should# G) _, ?* l/ i, v1 l
### have the same password database, and vice versa. The default realm6 ?; z7 {- @* `+ N7 S% ~ K
### is repository's uuid.
, w: T; ?, w( C1 P' A( yrealm = My First Repository
* M; n n4 r$ u9 ]! G7 B% Q2 D 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
- v- b( l: `5 a #killall svnserve //甇
6 y# n. |5 v$ M 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx: l& Y+ D* Q( e1 l- G4 l
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 C; j: k+ L9 V b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 # j( |, O/ [) ?9 n; V( F
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" :& x" G4 X, o4 @! K
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 $ W7 P8 z$ R4 K+ e% s' Y: ?
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled , M% s6 X/ [8 E, m. L l/ a' j
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
& l& h; ~! B6 k |