: http://blog.csdn.net/yanzi1225627/article/details/49123659
6 ]" Z0 a: I# c
7 T% b. T; d, a: K* a1 N/ R6 z格嚗剖遣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+ ^* x; f* ?/ ]8 M6 m$ K6 v 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx+ B- W# d' {0 `, H" L2 ~: B
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
+ U1 |# l h7 ?. j! E4 h/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx8 o" c! w/ W0 F* r2 W- L
4 i+ @/ L" g" ] g8 d& M/ c
chkconfig --add nginx
: W# {1 n/ y/ x' Q0 \
' |# Q& l% _- z/ k" kchkconfig nginx on% X, p5 J. h( {7 o
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash4 G$ g9 W/ o' k
# nginx Startup script for the Nginx HTTP Server
; a5 V1 _2 `5 L# it is v.0.0.2 version.
* V4 g+ P) F- c# chkconfig: - 85 15. W; ?) |: b* C. g @
# description: Nginx is a high-performance web and proxy server.
; c4 T; T# n& t8 J! m# It has a lot of features, but it's not for everyone.% l3 N1 e% `' f& v7 M+ \
# processname: nginx
7 f: H) Y, \3 c& @+ x# pidfile: /var/run/nginx.pid0 o/ Y6 `, w9 E
# config: /usr/local/nginx/conf/nginx.conf
' d! K' E& }8 U! V0 |& t' Bnginxd=/www/nginx/sbin/nginx3 q* L! g9 T0 k( r8 z6 ], a/ _% c
nginx_config=/www/nginx/conf/nginx.conf, h5 f- a, Z/ C4 q
nginx_pid=/www/nginx/logs/nginx.pid
2 a8 q& N* x! \; b bRETVAL=0% D! c/ [5 [/ d5 e/ T' X' r+ d# V
prog="nginx"$ E# s) D3 `3 S6 ]4 b( g
# Source function library.
4 v+ T9 V6 m$ q! r. /etc/rc.d/init.d/functions/ V9 M9 G' ]' K7 p3 K$ m2 o
# Source networking configuration.. D3 A7 _& J8 s. J5 w! c
. /etc/sysconfig/network
/ J( b% Y8 Z [7 ^# Check that networking is up.4 {+ g J+ Y; b! t) |* I2 s3 e, i- E
[ ${NETWORKING} = "no" ] && exit 0
, L& m- k& @, L- M[ -x $nginxd ] || exit 0
' w7 N2 d* }6 \% c) Z+ X8 x# Start nginx daemons functions.
8 _4 t2 ~$ j. ystart() {
+ }! T- Y% H' T) ^* N# c% vif [ -e $nginx_pid ];then/ l6 ?( G4 {+ A/ z! {0 q: e' ^. U5 @
echo "nginx already running...."% b) L; ]& r8 e9 D# P+ K6 [+ F
exit 1
% J3 B. u) z5 b1 @1 Rfi8 z5 m. J, C4 `) S) ]" ^% ~) H1 N
echo -n $"Starting $prog: "
. C# D8 R. a/ |$ u C# |' k$ `daemon $nginxd -c ${nginx_config}
% O2 l* ? S! E E' Q" D7 XRETVAL=$?
$ G8 ~& H$ q2 T6 v, ~echo
# j; q# P$ Y# V+ O; C[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
4 x. a9 r7 A8 H& E) Y2 d' R9 z- ireturn $RETVAL
3 S' M1 g# e# [6 v9 x% W3 ?4 I}- V4 l+ D; b. j; `
# Stop nginx daemons functions.! [, {9 Y( ~8 I7 }2 l5 N
stop() { t7 @7 i. y0 {9 j( e Q- Q
echo -n $"Stopping $prog: "
. {: i# s$ J/ Skillproc $nginxd- Q# }. |) q7 R4 X6 b. k- q
RETVAL=$?
?4 ~7 P1 n& ?' C, T6 k- Iecho
$ {! a, o2 I! v! V! Z[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid- P0 z. h! X+ D5 s+ O/ A
}
7 S# v' ~" I, Freload() { ?( n2 ^5 G/ U' X
echo -n $"Reloading $prog: "9 a6 ^6 l. l- _8 [" k) t
#kill -HUP `cat ${nginx_pid}`
) X; F7 r- z) P8 \) U- o* Ikillproc $nginxd -HUP$ q9 x3 u3 |1 `
RETVAL=$?
# z) j2 X$ `( Wecho
- C$ x- @( W3 q. Q}
% F$ D+ B$ {# ^1 n/ Z7 ]# See how we were called.1 h1 @- M7 ?8 D
case "$1" in
$ H& ^9 F& z4 u9 m2 bstart)
( a& V/ v9 F/ }) n/ o) Ystart
' j8 _; A4 j3 o( {;;
& n- \. C( A' L1 b$ Lstop)8 B$ e5 @# T4 L' s2 w' G9 |
stop, u- d3 o& ?5 X. M
;;/ y; x3 e" o1 L0 V6 P
reload)
. g+ a5 ~* W K* Z* l( greload2 Z. T. _% E. j% Q2 p
;;% j9 I) P2 ~4 v
restart)( H2 o: n ?! Z! q* T( k
stop
4 |1 G+ ~0 O5 e$ g4 v, y* n6 }start
5 z& Q. }" K# |;;8 ]5 \ Y& l* g- h+ |3 B/ D. ~7 c
status)1 B+ r, Y! ?- N' z; N6 k1 Q( G
status $prog
9 [9 H W# y# R4 C* x: iRETVAL=$?7 e+ Q# p0 r$ Y
;;! R3 M2 m$ B4 ]9 X" a
*)
" r- R/ C0 T- j$ M4 [echo $"Usage: $prog {start|stop|restart|reload|status|help}"
) \1 w$ K1 S6 w0 Q* {0 @$ kexit 1) p( `5 |: z8 U" R4 _' Q
esac
9 j" g6 u: f5 S6 ~* v/ }) W- uexit $RETVAL8 I/ d. X& `6 B! ]5 `
R7 [ T3 V) d: S
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
) e' d# J" k7 A: r; h+ i, ]: Dchmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗2 o8 X8 D5 k( F$ J# b
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 ) d* j" M! }; i
location / {$ J2 ~; N+ n* _
root html;+ O% R, P4 ?9 ~$ ^
index index.php index.html index.htm;
/ j ^$ v! C# x& h* ^6 C6 X }7 I) m7 o& h% \3 y7 g& _+ |, t. B
靽格嫣蛹嚗# q! C! \8 r* i7 X
, n! _5 d4 c7 Z$ i- z; S" C1 p
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 . n0 I) O4 I8 F p# K- D
location ~ \.php$ {
" n. R/ k/ p* I+ i3 W' p root html;5 J- ]$ C4 ^0 ^$ k. H6 C
fastcgi_pass 127.0.0.1:9000;' _( N* E& j2 d4 p7 ^% l
fastcgi_index index.php;
, V# z( _. f* [" U: H! Q1 p; Y' _ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
l o& ~3 c6 { include fastcgi_params;; A* {6 u) V6 x$ f
}
; V" ^6 d- I( M- ^靽格嫣蛹嚗
$ H7 L; i) r4 R( I+ q" ~
w6 @( i+ w5 I: N 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閫蝻拙僎餈唳桀嚗扯嚗
& w' w# j0 n( P, g, D/ Q#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 ~; d/ K' v& V* D( ^ K) H! M
+ o# z( V$ [( p1 W- m0 i6 n#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏" N9 |. }+ ?7 A- o
扯 cat /etc/passwd 亦冽瑕銵
! T* @5 x0 M0 `) I; gcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
* d5 \2 y8 K1 ~6 O( j 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
1 V" B3 Z6 h/ k 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql/ \& `% }8 F" G$ N: T; ]
chkconfig mysql on9 P" }2 p& x5 b& P
service mysql start --臬決ySQL) N6 L* \5 }% ]% a6 f' G
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
$ p+ |& X- G9 d- Y7 k" pexport PATH
$ f9 y0 \" d1 j4 ^ 靽摮source /etc/profile 扯嚗 ' L* H# H0 d$ C! C, s& D# |
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');' D, i( t' t- ?
4 Q( t+ a" r" ~/ e) ]% ]$ u$ k
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
- ^" v0 e q$ ?4 Bmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 # l* W! j- s+ ^7 O4 ^
#./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嚗
: N& }" h1 V1 HPATH=/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
" Q0 t7 p* r6 k# X
9 a0 y4 l9 z" Z r2 V9 e6 prpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
! A2 p: D0 D( m" P7 L$ [Create /etc/yum.repos.d/php-fpm.repo file and add:' |3 d- |0 X: X/ ~
- [nginx]
: }7 n6 x" H4 L - name=nginx repo
: l+ R0 Z$ V% C" G- u; s - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
7 n" ^7 V2 K. X$ }" u- I$ F( O - gpgcheck=0
" ]/ {- V! _7 n$ b0 S K - enabled=1
銴鋆賭誨蝣
; I& J b5 c5 i% }yum --enablerepo=remi,remi-test install php-fpm( W" S$ v7 P9 [5 C9 j
- O6 }7 J2 \/ t" k' _9 \; D6 N# Q, |5 z
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn1 V4 ~: [% w, B' B& Q* k' a/ h* a
嚗yum remove subversion //貉蝸雿祉svn T' f' w! R8 Z9 F
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
1 S9 b7 \, }: n 餈# 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]! `' c5 y: l# ]0 i u6 a
# harry = harryssecret' D/ I7 f- a; D- `* d- q! y+ a/ ~
# sally = sallyssecret
; }" Z3 R8 B+ X! Gwangning=wangning2 b- C9 R7 Z0 N0 r0 B( M0 [
yanzi=yanzi. b, o8 F$ ]* z% j2 Y) `* U
#vim authz //霈曄蔭
& _4 U8 |& S& z. a) G g[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none1 {7 ?5 l3 z& U C
auth-access = write
( \8 y; \3 s" O% W; G3 p### The password-db option controls the location of the password
9 g& g2 I/ B6 ?### database file. Unless you specify a path starting with a /,* d: c1 a" h9 Y% W
### the file's location is relative to the directory containing# K" z6 \ ^+ q E: W; z6 X# q9 ^# y
### this configuration file.
Q8 E( H# D( r5 R7 c1 F7 @5 C% i### If SASL is enabled (see below), this file will NOT be used.
5 v% l6 E- S9 I### Uncomment the line below to use the default password file.! l7 N: u$ o, W( b
password-db = passwd; P( Y: L' j1 D
### The authz-db option controls the location of the authorization
" Z" R% B+ @* ^% T8 f4 t: z### rules for path-based access control. Unless you specify a path
7 Y7 N) F' g" N' S6 P3 ^+ c### starting with a /, the file's location is relative to the the' F# g% A! ~( c+ p
### directory containing this file. If you don't specify an3 i- s( Q8 z# q2 a
### authz-db, no path-based access control is done., o+ `5 P$ M$ r7 o9 p2 d$ k
### Uncomment the line below to use the default authorization file.9 @0 l$ a m% T# s' C
authz-db = authz# z% D' k6 E( ~6 m) N' i$ S
### This option specifies the authentication realm of the repository.
. t- |3 T& N; O: l+ x& I### If two repositories have the same authentication realm, they should; Z7 v8 A/ m* t P# @
### have the same password database, and vice versa. The default realm _) ~# s$ o6 f' q' _! e: ~! K
### is repository's uuid.4 w( a0 d* p: v5 V: B# R
realm = My First Repository# r" w) G7 U* j) X$ g5 p
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn3 q! D# @5 H( V* s4 L3 V% b
#killall svnserve //甇
1 B6 ~" A4 ?4 D& Q0 w( ~ 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
) q7 ?8 `7 x% G$ t( D6 v3 \ 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
4 r' h# I @; v- x9 D1 y6 {+ E+ p b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 ' m: ]9 E! N2 G$ b: r: O; s8 o
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" :5 c# g" ^; L* F( P
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
4 `% M' V) k5 h9 b! Z瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
; j0 {' a" U( D9 [ ?' V5 j) w4 H) }vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
1 w8 J8 H' q7 }1 C |