: http://blog.csdn.net/yanzi1225627/article/details/491236596 G$ x% N! f/ S8 M; D4 r& K9 q
( Z8 P# ~# ?* L$ k: u6 x& W& B2 i
格嚗剖遣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- k6 ^ l' v+ i5 g; a9 Z# t8 C) u
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx! Y* p; V+ Z/ Q6 Y, u) \
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www3 j: D) v- l* C# Q) F1 Q) g6 S
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx H! J: M. C1 o. X
% n+ W: J8 q3 s3 o
chkconfig --add nginx
% T, A& g" ?9 e1 |# K& i4 c3 [/ Z2 y+ h
chkconfig nginx on* Y9 ]% P; x( p o: e
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
1 U5 J/ n. K8 F% v( ]8 j1 W6 [# nginx Startup script for the Nginx HTTP Server
! v6 v( i: m% X9 `& [0 J# it is v.0.0.2 version.
. r, o: O4 u N' Y$ [7 d3 h# chkconfig: - 85 152 f8 C$ _) r5 S
# description: Nginx is a high-performance web and proxy server.% t& a v$ w2 p' u
# It has a lot of features, but it's not for everyone.
) x& m5 U" Q# J7 M; }+ J# processname: nginx( n( {6 L+ I9 C7 V" B
# pidfile: /var/run/nginx.pid
3 N9 l/ x. G$ r( `& z( B# config: /usr/local/nginx/conf/nginx.conf
! t6 K1 v, I- ^1 a* wnginxd=/www/nginx/sbin/nginx; u( s U; @8 }: |" N2 \: q
nginx_config=/www/nginx/conf/nginx.conf5 F( @5 c6 i# j0 h5 S# R
nginx_pid=/www/nginx/logs/nginx.pid }& S' p$ ]/ x1 K
RETVAL=04 D: o: \& K/ k" {* Q" V" i1 e5 g
prog="nginx"+ L. E: Z0 R% b/ y, O
# Source function library.
1 M! Y6 a2 w9 @- Q8 w* S. /etc/rc.d/init.d/functions
) K/ C: r1 W: t; i# Source networking configuration.
& y+ J3 Q: F$ D" i- N" g8 S. /etc/sysconfig/network
, Q0 y, `! ~6 v' S& d( f" ~# Check that networking is up.
3 G t* w: R9 x: J& e9 U5 J[ ${NETWORKING} = "no" ] && exit 0
( _- j: i- B8 W[ -x $nginxd ] || exit 0
* E6 u' W: w* f& T2 t# k# Start nginx daemons functions.
" n: p) H1 A j0 h& Hstart() {
! C: z4 v4 W0 ?0 }: rif [ -e $nginx_pid ];then
. F7 t: P& \* y; ~3 ^6 n' J" Vecho "nginx already running...."
/ l! a9 _4 y3 }+ u1 G; R& b& Q$ u- Yexit 17 b% n- j; `/ \ ~. Q
fi0 V8 T+ a! ]/ [6 ~+ ?
echo -n $"Starting $prog: "! b6 Y4 V3 j: m
daemon $nginxd -c ${nginx_config}3 A7 W7 {4 A" x5 y7 [- ~
RETVAL=$?
' ~/ F1 w7 ^' Techo
1 u- {4 I: T) ^* B! I8 B[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
$ I, M, t. z& Dreturn $RETVAL
/ k8 t$ B" n2 D7 Q6 M}
3 ]8 J/ w" x; T( Y1 E# Stop nginx daemons functions.5 }% B i: y6 n; U2 F
stop() {
4 Q1 t% p. v7 C2 N4 a E7 _echo -n $"Stopping $prog: "
0 f \% W4 x. v L% o( X3 b! E+ ]killproc $nginxd9 o3 H( u9 z, k' c1 F) m1 c
RETVAL=$?
) r4 D) ^# J: {% l+ x. Yecho
; l5 T/ w" j% g4 y[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
6 s0 i! L. Y g1 _) i- z! v# z}, R% p- s- z. ~# R0 c/ ~; A
reload() {0 l% x$ l6 p1 @
echo -n $"Reloading $prog: "
' U7 L2 j5 |; W4 J* J4 [5 ~) u#kill -HUP `cat ${nginx_pid}`
1 R, V# J M& t2 ] }killproc $nginxd -HUP7 G k: d0 l0 S2 l* @
RETVAL=$?/ W5 F# c* w, F' V9 E
echo Y) C/ B R" Y1 z" ^4 A
}6 |$ S! `5 J1 C
# See how we were called.3 y/ x% I) N$ l, j
case "$1" in
+ h+ z1 ]! P8 Xstart): a2 t+ B( g4 Y8 U' I7 N
start
! M2 w) Z6 D T8 E. g4 o;;( Z1 Z% r. f2 D& V O
stop)6 L6 h9 S) A4 v' h k
stop
3 f9 w: |9 E0 C; p7 M* y;;* W! j5 X9 V2 l- d
reload)
# \1 ?' }: u1 ?9 O$ _reload
+ a3 U# e" q5 }0 x;;( W$ R4 `1 L& G& K" `! P8 V
restart)
6 y! E; B1 b* L6 A3 mstop: O2 K9 o7 I! N0 c3 [$ s
start
* U2 u5 C0 {9 w" @' s( C;;! X: A+ j, \+ s7 u
status)
1 X1 B+ D R/ ?! z8 y0 vstatus $prog0 b7 b8 z6 ]6 I& C8 f% {% V
RETVAL=$?
' R+ m- |- F+ @- d;;7 _8 P. @5 u2 X! ^. [' M$ D
*)2 k+ [9 P+ C, ]. ?5 U8 `( Z& w
echo $"Usage: $prog {start|stop|restart|reload|status|help}": A/ G- m6 j7 F4 |' ^
exit 1
; N2 s# ~' N4 W1 T0 {2 J* Fesac' S2 k7 O; x6 `
exit $RETVAL
- Y/ o1 X; f3 J4 f$ n7 `$ p& Q1 E0 g% w. t% r6 A
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 4 A; [" ?/ a. {. C- Y) L: G* p
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗' f. O4 N) M! n; |
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 - V1 f9 I' m" d1 V/ b% p* ^' P' I G
location / {3 L# ?, h* d/ ~9 L
root html;% t x: U9 C4 l' U0 {, C6 e
index index.php index.html index.htm;4 x x: \6 s# O( B
}
# N, L* ?/ G2 N5 }/ {# s# c8 B" Z0 n靽格嫣蛹嚗* h- W- n9 Q1 O9 }- e% x
9 |" p5 M; g" g! {: f
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 }% G3 L2 O1 l/ R
location ~ \.php$ {
9 j9 j3 x5 m( b# b root html;
$ c5 j' B _" _ fastcgi_pass 127.0.0.1:9000;( T; q1 ], Y% r1 H- V
fastcgi_index index.php;
% H2 `* L- c. G& g fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;! I$ o9 ?- a% t, ^. v
include fastcgi_params;
) k* b5 ~5 Z" W1 f; F, M* T w# C }# u( V6 N9 i7 {1 L
靽格嫣蛹嚗
* z+ o, w* D( m& \! N
: e( G0 W1 |. ]" v/ g% K6 D; u 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閫蝻拙僎餈唳桀嚗扯嚗
9 P2 Y) d& a/ D( J: o5 \6 z#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
8 f( O" G/ a* e1 K, W# W4 ?5 Z, q. q- k
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏! ^& W" O0 l% W4 V# O& _1 t" W
扯 cat /etc/passwd 亦冽瑕銵
$ r8 k0 i. j3 U( Q; p: jcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀) G4 J2 ?0 X/ i3 y; Y J2 n
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql/ e- H1 \# I4 g. G8 D
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
% P# @" Y- X7 Bchkconfig mysql on1 f+ g. m, P7 G" z4 T$ t- f
service mysql start --臬決ySQL
1 H* I& w% O& H- _' b, N7 ~' e+ m/ X 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH9 g& S% b3 O8 v5 C/ I/ b$ y$ V# P
export PATH
R0 L6 |: R( v# P) f$ x: _ 靽摮source /etc/profile 扯嚗
* I: I' R7 K) O: R2 W9 ], |. kmysql -uroot mysql> SET PASSWORD = PASSWORD('root');
5 a9 c( U3 Z2 l
N1 Q" K6 s1 r- R2 @霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
) }5 m: D6 q1 ?6 H9 U) U; Wmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
, G4 Y' J' w$ Q# t& b9 h#./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嚗 7 Q: `, ^; h7 R( N7 u" b! _
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
* @% n, P: _2 _6 |( M) S0 Y
: L* r, B& v3 [5 b4 \+ n& Qrpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm5 o! I8 T( r$ J+ P1 f
Create /etc/yum.repos.d/php-fpm.repo file and add:; L" |: G- y t2 O( y
- [nginx]
, H4 J9 g3 i* I! {* ` - name=nginx repo
P! i2 a7 W( o; _4 y - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
. w& a6 Q# u% Z8 o - gpgcheck=0
; V$ P. G7 T3 p0 \) r7 W - enabled=1
銴鋆賭誨蝣 % K2 B/ v, S/ ~% J
yum --enablerepo=remi,remi-test install php-fpm% v) @7 i, H& L- d/ l
( ], P; V, U6 N$ L. T2 F* Z# @
+ |8 a: z" `8 m3 a
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn5 t1 ~" V8 K! U4 K
嚗yum remove subversion //貉蝸雿祉svn
2 ~3 q! I8 w" \- o' e$ ~ # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn- X3 x, _- p1 S/ 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]# Y1 Y+ k N: c6 ~& D
# harry = harryssecret
) E2 ]1 k; L7 r0 B- B- X! m1 n# sally = sallyssecret! y, p1 G% g8 w( q3 [4 }9 t
wangning=wangning* s9 \, R. h5 H* E" @" l
yanzi=yanzi$ z* j+ d6 A6 F& \
#vim authz //霈曄蔭
, g# A4 O( v( _ _3 T: N! J[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none: Z r# x( b, C4 b- d
auth-access = write
7 j2 R R, H! s9 F V. N2 t& P### The password-db option controls the location of the password% B( i3 q. v2 v
### database file. Unless you specify a path starting with a /,4 m1 V" O" A! r( ^
### the file's location is relative to the directory containing
8 ?$ [) Z0 _/ F8 d8 {### this configuration file.
0 O1 u: v; p" F4 y3 I) y' h5 Y### If SASL is enabled (see below), this file will NOT be used.! B( K4 ^( t3 M' B P5 M+ m
### Uncomment the line below to use the default password file.; k- `+ E& q. h- C) E
password-db = passwd) `: a& S# d/ s% R9 `9 U
### The authz-db option controls the location of the authorization* {' R5 k! o) \! X
### rules for path-based access control. Unless you specify a path0 H; E. \# d+ j5 p& d" `: _
### starting with a /, the file's location is relative to the the i$ F0 J, _7 ?! @
### directory containing this file. If you don't specify an' z. g8 y+ \- X- Z# b. S' \) R8 Y
### authz-db, no path-based access control is done.
* @- u9 }2 D9 V# f: g, k. `### Uncomment the line below to use the default authorization file.
. Y+ Q' c8 \& X. o8 |+ W5 ~authz-db = authz
8 L7 y! o* n7 h7 D0 d! _4 w### This option specifies the authentication realm of the repository.9 M% H" d t5 ~1 Y S
### If two repositories have the same authentication realm, they should
) T, x8 m; s. L J( w0 K8 G' R### have the same password database, and vice versa. The default realm
* x+ a9 H1 O/ H. J. V( b### is repository's uuid., L# S& Y! v. {- z5 P! K
realm = My First Repository/ D8 a6 ?' G8 S
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
8 T4 a0 l$ R W2 E6 b; u+ e5 f #killall svnserve //甇' m8 j, J' v! {
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx4 f3 T N* ^2 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/ @6 x" D" L& V, J. m3 y4 D0 [
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
, c+ z- J0 E8 qexport 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" :
0 `& }" e6 ]% q, ?4 T7 b+ I. Z8 b3 q#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
5 H) E$ B& ?2 X6 |瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled 9 |1 ^5 K3 N# |. d* P- k; p
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿/ N+ @3 M: ]0 a# g8 O$ [& x5 N
|