: http://blog.csdn.net/yanzi1225627/article/details/49123659+ [; I {* s& Y8 q
% i( g6 p( x$ q7 q0 e ~ W格嚗剖遣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. X: |1 [& C q- d; ~( D2 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# y) G4 R3 u0 }& C; h8 W, ?/ V( C
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www/ V. Q3 N& C' u ]
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
9 O1 y' g; j- G* Q$ s
3 ?5 B) f! U7 U* ^% @ xchkconfig --add nginx
9 O4 V$ Y1 z& y# o- Z: i. l6 l9 N7 E- a5 p2 w
chkconfig nginx on% Q# H6 l1 a6 B; x u
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
; w: X4 v: o- S# nginx Startup script for the Nginx HTTP Server! J6 E% {/ Z: P) E: _: v7 f
# it is v.0.0.2 version.
+ H% G0 y3 ~% [1 R# chkconfig: - 85 15# V7 L+ J5 B g
# description: Nginx is a high-performance web and proxy server.% `4 Y! D# `5 ]; O2 o+ k" c- _+ `
# It has a lot of features, but it's not for everyone./ {1 X6 ?& f9 d _
# processname: nginx
( }; ]# G% i+ H {# pidfile: /var/run/nginx.pid
- b" g; W; [; v; g' o# config: /usr/local/nginx/conf/nginx.conf: i( U# I# k: h; W8 B
nginxd=/www/nginx/sbin/nginx
$ D8 L% f8 \, P W m" S8 ?nginx_config=/www/nginx/conf/nginx.conf
/ F0 g0 S4 @, K3 u: d# w* nnginx_pid=/www/nginx/logs/nginx.pid( U# U1 O! t( C; ~5 N
RETVAL=0
1 c/ G3 b5 e, n& q! Lprog="nginx"
9 G X# g b T& k0 T0 K# Source function library.
; {' F& E \* h3 E! {+ D9 G. /etc/rc.d/init.d/functions
6 Z. y3 h6 g* F: k# Source networking configuration.. P# U$ U A* c7 l$ T) P
. /etc/sysconfig/network
+ ]0 v0 t# d# d: o& B' Z# Check that networking is up.
. U8 Z; k& L |/ S0 J$ Z7 t[ ${NETWORKING} = "no" ] && exit 0; u" q' _0 X) J6 z8 N$ K% c2 x
[ -x $nginxd ] || exit 0
7 i6 m3 C* f. `9 F( w6 J- O" P# Start nginx daemons functions.
0 Y! f* T3 V, V5 @start() { l7 J% L, L# Y+ u
if [ -e $nginx_pid ];then
2 f/ \+ F- x; T& Xecho "nginx already running...."; v4 K1 J2 ?/ L: i6 q1 v
exit 1# U! a1 t( K- H# ~
fi
8 b" i0 @7 s$ Q. Eecho -n $"Starting $prog: "
) R* ~5 k1 \& A" p/ l udaemon $nginxd -c ${nginx_config}
! U. a) |+ P+ h* q( ?& X7 }RETVAL=$?: j/ M6 n' M& u+ I: @
echo; z) t6 H9 K) O/ b; q: M5 Q: n: F
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx' X7 B$ v2 x% x% K3 S+ _1 \2 h! i
return $RETVAL1 u, @. }, A$ @: J
}
' R) X i5 V- O+ {7 `7 n5 R" I$ ~1 A# Stop nginx daemons functions.
, A7 a; {" d0 V, ]5 e: Vstop() {
. x7 G9 y! X6 x+ Uecho -n $"Stopping $prog: "1 X% O( ], d0 z1 o I, l6 {. \
killproc $nginxd6 J7 n! y6 O( t% } A8 c
RETVAL=$?
E' l6 j1 J3 u9 \echo! j) W1 d. A8 ?5 P2 u+ f6 A
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid7 x/ l& D, T# n6 C3 P) K8 y. D
}. F% W- f L- T0 }( d
reload() {: n3 H6 Y# `% ?1 ]. w* [' I( l, A) C
echo -n $"Reloading $prog: ": R& V& {; ?* c
#kill -HUP `cat ${nginx_pid}`# P% x1 T3 p1 T5 q/ m
killproc $nginxd -HUP* o* t3 S: ]3 \% a, i2 c, u2 C
RETVAL=$?# m! k- h5 ~ I9 B) h
echo
. E, N; u4 O$ D0 Q; \3 Z}6 n- Z; ~& L+ E4 e( X$ S9 D
# See how we were called.
) ~- M1 L4 R$ Z8 p: R: E, `case "$1" in
; b! ~4 p: ^4 Y: b" u3 Y9 ]start)
: O# @4 ~$ ?$ |% z, q" A' Istart; Q- V: E' Z& q
;;
1 X5 N. {) `( }0 Ystop)8 ^/ ^, B! O& O
stop2 C; j: G" ]2 g, H+ B/ v' Y5 w
;;! e, }+ C+ j6 v3 d/ P# o
reload)
) k$ j& ^: B" l1 z; _reload
2 Y; r5 s' t0 }/ f" @;;
2 r/ s6 t8 B+ n1 `8 X6 k3 H; yrestart)1 A% p& e0 K& R' N
stop0 U1 L- `: @; y% f: D
start
" i+ C# l* d, J* O; m, c* n" R: p8 k;;+ i+ Z& [! L8 t9 _, E8 U
status)8 C" N! J3 @* Z: Z' v& n
status $prog
: k1 F5 D9 k* h7 X, z8 I3 Y5 k3 nRETVAL=$?
3 s) s8 D! i/ Q* M/ `/ v2 @;;
! B7 v2 @/ p: z9 S*)
. Z C3 T/ v" N) S; P7 Becho $"Usage: $prog {start|stop|restart|reload|status|help}"
2 V6 p7 O6 C! a: u5 f8 r. r6 h' Hexit 1& Y& E# [# }0 u2 N3 Z9 ]
esac* q, \! \: n- | i) G- {
exit $RETVAL: H7 n" s; W9 {& P8 g
% D+ @: A3 Y+ \# Z) ?& V; O 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 1 C# K2 q" P. y! j' @
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗, G' S/ H. p) Y) F
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
/ l: L) K& u; { location / {
; S9 O+ B9 [) [- T% p# G7 E root html;
/ e' p6 d8 e% D2 y% G, i index index.php index.html index.htm;
$ x. y9 N0 ~3 R1 \; q5 [ }
: B: E' e4 o* T靽格嫣蛹嚗
$ j" g2 C( K9 _: Y
8 c/ e! G. {! V7 Z( M' |/ ~; n* c location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
* Q. Q4 _* }; ^8 h0 Y# I) L, Z1 Tlocation ~ \.php$ {7 d' P% J3 E+ m' B; p/ l
root html;
1 h2 e+ X8 r% B5 T" o$ b" X6 y fastcgi_pass 127.0.0.1:9000;3 y- F+ Z7 [# x9 A# ?, G, M5 U8 I1 G
fastcgi_index index.php;
, a' a% ?7 t/ u4 |! l& L( k" t- p fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; G, z @, p+ N7 r; J' P
include fastcgi_params;
* A* v, `- C8 `0 Y. s9 a. X }
4 W6 |$ a. L; y i4 S/ v4 k! Y靽格嫣蛹嚗
' e& ?' C3 Z+ ?, e0 X1 P5 ~* J9 ^& f) b. V5 K8 N3 C# ?6 `
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閫蝻拙僎餈唳桀嚗扯嚗 ! y$ y) R7 p0 R6 ^. t% m
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql- B* d8 v+ a" w: H' r& n
4 b. e5 h; O) w4 H* Z
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏* ]. b! U/ B" v6 D5 f5 A! J; d
扯 cat /etc/passwd 亦冽瑕銵
6 K3 n# Q2 U9 y2 d: Mcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀1 z1 J' z3 S+ Q
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql. H; N0 f0 ?5 f) `
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
8 M/ l; z& k6 a3 e. Qchkconfig mysql on5 z9 x5 T1 h4 b
service mysql start --臬決ySQL* [* Z" M1 q; ?
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH* D3 @8 `1 k5 ^/ B+ o2 g m( K
export PATH
# u- J0 O$ Y+ K 靽摮source /etc/profile 扯嚗 . ^5 g! q# q2 E3 H. ?7 w G3 ]0 u
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
8 D* A2 |5 h+ Z+ f$ b5 P
* w5 o7 K* I- p: i( |霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
I# I5 Y/ B! f1 W+ m- Zmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 , ?. d* n) Q# `+ j
#./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 b* D8 d' n+ {1 a3 f9 X; [) C" p
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.rpm0 C0 z# F: J% u4 U2 ] p
$ T# V" s' H& B0 X
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
' `& P3 i( i/ i# p3 \' I dCreate /etc/yum.repos.d/php-fpm.repo file and add:
, V5 R' j$ m* `- [nginx]: X" ]) H& J3 ^3 R' A
- name=nginx repo9 M* i9 f" G* w6 K1 x! i
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
4 R) \' E+ j/ ]$ f0 q. w1 a) c( z; C8 b - gpgcheck=0! L: L4 b7 k9 Z" l
- enabled=1
銴鋆賭誨蝣
: A% @+ B/ |, g f, S7 Yyum --enablerepo=remi,remi-test install php-fpm
2 S7 u' j) r& E0 M- p8 W* s* g
+ V4 t4 U4 g: b, ~6 b8 `1 C# w6 v4 \0 m# m1 E9 ?/ x
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
7 n q+ w5 l x 嚗yum remove subversion //貉蝸雿祉svn A2 _1 G# j. |% P" \# ] v, ~
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn* s9 e% q' ?2 g3 X% Z+ z7 {
餈# 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]% D; k" ?) @+ X y, }( [( N2 c
# harry = harryssecret
U6 F+ e2 { ?# sally = sallyssecret2 M8 _/ Z" R( ?5 ~
wangning=wangning2 j2 C* ~# `0 W* x+ Q; O' T" N
yanzi=yanzi" g$ R* q9 M+ g$ r
#vim authz //霈曄蔭 " D* W1 Q$ t' f9 g/ r. y/ T v/ o& y
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
2 U. w! w; P' j j5 s Z! \auth-access = write3 ]) u) C: j y3 f# z
### The password-db option controls the location of the password2 ~% b1 ]# o2 Z( @
### database file. Unless you specify a path starting with a /,$ d- ]% u6 ]; O; R) K
### the file's location is relative to the directory containing0 H7 @ T1 @6 P7 B2 i, K
### this configuration file., [4 T2 |( Y7 U% F' k S$ |
### If SASL is enabled (see below), this file will NOT be used.1 E) I4 l$ s) S; @) M. h2 t
### Uncomment the line below to use the default password file.1 ^/ F, K; F- E( e
password-db = passwd
7 T5 a3 r4 m5 Z7 R# V# S/ `### The authz-db option controls the location of the authorization& v% l" H* H z
### rules for path-based access control. Unless you specify a path
+ A; a9 _9 _; E2 _6 w### starting with a /, the file's location is relative to the the4 b, c) Y o$ U
### directory containing this file. If you don't specify an( X0 G* e+ z; w
### authz-db, no path-based access control is done.( u6 j4 h3 C0 V/ P
### Uncomment the line below to use the default authorization file.6 a2 ?6 R8 S7 O8 B) e; k
authz-db = authz0 S; |% z1 L0 y d
### This option specifies the authentication realm of the repository.
2 T* l/ N W0 x# t$ Z### If two repositories have the same authentication realm, they should
" L5 z' q! }0 |# ^### have the same password database, and vice versa. The default realm, Z& h2 l! y0 l6 n3 x' e1 n
### is repository's uuid.7 m' B: u- d U' O' v2 N* X. {
realm = My First Repository* l. f: | s% t7 I) K
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn& B! E1 p$ \1 h, X5 m. w
#killall svnserve //甇8 B% W" I B9 P ?( Z3 m7 y
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
`% D9 D @% d4 S 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/web0 ^8 F+ F8 [; h% @
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 ) l4 @0 v3 H7 \' ~- H
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" :+ i6 J+ d) ~4 h3 j5 l2 v& D
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
( ~5 r7 d" f% Z- w' a瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
! g/ r, Z* J# y+ Vvi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿9 q) q5 a7 }+ `
|