: http://blog.csdn.net/yanzi1225627/article/details/49123659
6 M; c( W/ @3 k/ V9 |1 X9 L
! p6 @( I5 w6 B: `; X1 K格嚗剖遣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
. j- h' b v. h( T( y 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
9 K) D$ u# M7 _7 A( O/ u1 ^ 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
3 ]. Y% y+ M, @6 y/ _/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx# x3 T6 ~$ E6 v
0 k+ W( m( ?% v1 D, \
chkconfig --add nginx
6 ?9 A6 \# G; n2 O
# z0 u; a, ~- Kchkconfig nginx on! \' Q+ M9 u7 v/ P0 Q
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
2 S/ q: r3 c" w# nginx Startup script for the Nginx HTTP Server
" N Q; y Z! T2 Q+ S# it is v.0.0.2 version.
) L4 ]+ p1 c' x; l# chkconfig: - 85 15/ `" ?" k e/ ^
# description: Nginx is a high-performance web and proxy server.
, J& N! q( k- U# It has a lot of features, but it's not for everyone.
, e: i' M6 X" e# y) [. ~1 n8 B# processname: nginx
- [ _: c$ E/ l; [' p. q# pidfile: /var/run/nginx.pid
P9 k/ @% L) P% M% E% M# config: /usr/local/nginx/conf/nginx.conf* b8 B, K+ ^; O
nginxd=/www/nginx/sbin/nginx
4 I; S: m4 z. Y% |9 ]/ o9 R* G# Onginx_config=/www/nginx/conf/nginx.conf$ H; L2 U( M5 `! M8 K
nginx_pid=/www/nginx/logs/nginx.pid6 d+ @$ l! _; n+ t' ]
RETVAL=0
0 }0 h4 r" m- n8 ^prog="nginx"' b$ L8 ]# j+ w' A4 x5 S
# Source function library.! U' x9 o' g3 B9 Y5 s8 M% b
. /etc/rc.d/init.d/functions
z6 y) L4 D! K) V% _# Source networking configuration.
4 y" Q/ T* s6 t0 z- @. /etc/sysconfig/network
" E4 x6 W! R o# Check that networking is up./ F+ m4 ]' _# I) Q7 U2 ?: a
[ ${NETWORKING} = "no" ] && exit 0$ P, v g0 j3 @$ U. }0 |
[ -x $nginxd ] || exit 08 h( R& ~+ g) f0 ~
# Start nginx daemons functions.
% V, V. D$ K$ rstart() {" c/ _/ d8 u+ \, s0 _1 ~: R$ _
if [ -e $nginx_pid ];then! t- u7 K/ n# t' R$ n% r+ V: f) v
echo "nginx already running...."; ]5 l- ~- X* Z: w" T
exit 1
* `: O6 Q" b) A9 c2 z3 }fi {5 Z/ T* Z% J
echo -n $"Starting $prog: "
$ Y2 Z6 c: r: {/ G @daemon $nginxd -c ${nginx_config}
' V% L+ Z& R3 [, KRETVAL=$?
3 L4 F* Y6 c- _3 ?5 r3 P2 o: @echo" H0 o$ e* `" x
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx( f" k W" y2 u7 ?; \2 k
return $RETVAL
* T9 O7 F8 d1 Z& G2 s1 I8 O) n}& }0 m" n' T* z- k
# Stop nginx daemons functions.
4 T4 E) n9 a; M" C5 F0 P, j: G) C$ Dstop() {$ x6 g8 t8 \; B" M, Z: w
echo -n $"Stopping $prog: "- P/ H5 {) n) k5 ^ ?( |
killproc $nginxd
0 K: b6 H! P6 }0 V8 Y* HRETVAL=$?. Y; @( j8 c. |! E1 y! R2 @
echo) i+ z. v) P) g, C7 a' r# g+ @( x
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
: ]0 ?: L! r3 a. _}" Z$ G( ?" C/ U; ^: x
reload() {
, l7 R) P; ] g" e9 Eecho -n $"Reloading $prog: ": R% N9 w% I- ]- f$ l+ N. J
#kill -HUP `cat ${nginx_pid}`2 O' D& N! Z' s" \& b$ L
killproc $nginxd -HUP8 ^* ]$ H) B$ U% S
RETVAL=$?
3 @! k% c Y8 H, }+ M% aecho
* {& ]- n2 B+ s% b' a1 S$ y; T! Z}
1 ~8 b, C' H E1 U9 `4 a u4 T# See how we were called./ P: p+ D& r I$ E8 `4 |) Q$ R* u
case "$1" in
/ G z- M. w& E( |) Q0 ystart)$ L5 r9 [3 X6 y% R a7 ], s5 Q
start( ]( l. l3 \7 C
;;. r- e: }: p( W; {
stop)
/ R0 W1 n: j# w! Cstop' P# O8 t* c$ Q( D+ n
;;
9 \3 z) Z6 }3 R& f/ \0 ?2 Lreload)- v5 q L, o7 p, {
reload; ]) K6 k4 _0 g9 j
;;" D# d! M1 K. p( T2 }6 O8 \$ f
restart)$ z' K" z2 v7 q. O8 j' h
stop
6 |1 S/ j! `1 t p, ]2 vstart3 w) X/ g+ A* x) Z8 [
;;
3 T+ M# m, b9 _+ c, w( Y: W/ E+ Estatus)
( b( Z+ U3 l$ G4 G# w1 M7 @' W7 Ystatus $prog
8 s# d0 a8 k7 y5 M! o3 j( FRETVAL=$?
- }9 C' D( q0 N8 |! i( l;;
/ M D& B5 N& _4 M1 b; W$ G' t*); L1 [& C. Z* f7 r s
echo $"Usage: $prog {start|stop|restart|reload|status|help}"3 u0 X; ?1 Z! f+ \0 N
exit 1& a$ ?" {" s+ F7 ]
esac! Y% u9 ^0 Y9 J0 a- `6 g9 p
exit $RETVAL3 @4 z2 K* y/ _
- f ?3 v" f7 G' b1 q
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 1 U" g5 `- a, c# _
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗+ @& q. D: G' X7 h! i
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
. Z& `" b) n7 J' y location / {
/ }+ P3 h2 O; L8 R root html;% L! \* O4 M* x, ~& m
index index.php index.html index.htm;
# S5 M. w, X8 b* p | }8 [0 l$ E, c' \! O' ^: c/ F
靽格嫣蛹嚗
& c! D. g+ l2 ?$ ~: }
" N! ~8 W, Z; b0 y. k* s5 _( L location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
/ P9 e `# ?6 Y( |9 y1 D' |location ~ \.php$ {
4 `, t& p D* j; T" R, Z* U7 ] root html;; P; O+ w* B; [9 {" G+ s. j a
fastcgi_pass 127.0.0.1:9000;
3 P3 j) i, U, X" G1 @% i; i fastcgi_index index.php;' b; l4 t+ P" m/ f, Z2 o5 R/ |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
( }9 ~* p$ n% N include fastcgi_params;* [$ z: B Y- n: l% `
}
9 \1 }$ a0 w( W) L& Y; u8 R靽格嫣蛹嚗9 |- z4 ?6 \' q/ Z0 g7 _
/ e5 X- F4 P6 ~8 n% |4 ?) P 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 @1 Y( @9 u# J+ {+ ^
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql; i- O7 U2 N! j( w* l
0 H: l, R2 ^3 N#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏+ }8 p1 S" t4 Z5 |" x" X- Z$ y( P
扯 cat /etc/passwd 亦冽瑕銵1 n# B0 g6 F* ]
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀 A' c: s$ A9 F4 O4 j
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql2 z" l5 j0 x$ }# V/ `+ t; [1 N3 h
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql" ^6 ^4 S% E7 R" O7 a, c1 A1 X6 k
chkconfig mysql on( J" G$ p+ [$ ]
service mysql start --臬決ySQL: v8 E7 S2 p# P. B& ` X* `9 j: e+ U" w
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
2 K7 h/ i7 D/ M6 A2 t3 r5 F: t4 A2 Aexport PATH* V+ e1 q' A7 k. q- S$ b
靽摮source /etc/profile 扯嚗
5 C7 ~8 {2 Z& L- bmysql -uroot mysql> SET PASSWORD = PASSWORD('root');
8 v+ N# Q! y6 h( q2 _& ~% y9 f) ]5 q: u, f2 ?: v
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 4 \3 O& r/ ]: M% \& C) A
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 1 Q- [5 x6 l. Z% c8 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嚗
5 A4 v1 _! E0 s7 [/ {1 `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
& X5 S% m) O D
: X* N1 g0 V0 {. rrpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm+ F0 i$ K8 H9 J& C: @- z/ ]
Create /etc/yum.repos.d/php-fpm.repo file and add:# Z; [7 p1 o2 g2 Q# l0 Z6 e
- [nginx]3 |4 U( R" Z, \4 t, F' t H/ F' C
- name=nginx repo
: d, H, N$ F, K" y6 d8 S: @ - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
/ \: H8 ]8 F8 R( B+ Y - gpgcheck=0
# K0 Z. A3 h" I# o {5 v0 M - enabled=1
銴鋆賭誨蝣 # R" y/ r8 M6 A( k! m" V0 V1 a* i
yum --enablerepo=remi,remi-test install php-fpm/ k3 O9 Y& y d0 n
9 t! N7 \4 f- D/ ^1 w2 M
: ?& |. [0 j4 |
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
c( k+ x8 ]5 J) D0 \+ R: Q 嚗yum remove subversion //貉蝸雿祉svn! n0 g, L/ Y( P! s% U& `0 l
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
1 T5 ?8 o( r9 `3 q) G 餈# 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]- q) D& F2 z" ~0 N }. T8 Z4 o( k" y
# harry = harryssecret# G4 o$ @7 _: K: l0 J# m& H/ g
# sally = sallyssecret3 A4 A( U' j8 w5 G
wangning=wangning
7 j5 Y$ [2 E4 C3 r4 ]4 g& j) L& E: N3 |yanzi=yanzi+ ]0 m! { m' K7 Q( j/ x7 s2 W$ `" G
#vim authz //霈曄蔭 5 B8 ?- o4 \0 k8 V: f
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none5 p% D; {- \* h/ J
auth-access = write
: f: h1 b3 d) D+ c4 R n### The password-db option controls the location of the password1 h% Z- V$ H! F' }( {7 x) f# \+ o
### database file. Unless you specify a path starting with a /,& X5 B# o) E! A& ?. V7 d$ m5 Y
### the file's location is relative to the directory containing; I4 @& E5 w9 b5 Q4 C
### this configuration file.
A+ [9 m7 s" i" Z2 X### If SASL is enabled (see below), this file will NOT be used.6 O7 W0 I7 v ^& N
### Uncomment the line below to use the default password file.0 O. j/ _5 W0 l1 m
password-db = passwd
! c. s! n/ @0 {: g) J### The authz-db option controls the location of the authorization$ k1 z( s* g) c2 u) q9 c
### rules for path-based access control. Unless you specify a path" a& w" k4 R8 W& C/ Y6 G$ ?% H- l
### starting with a /, the file's location is relative to the the# I5 a6 L/ N7 A0 _2 S. f
### directory containing this file. If you don't specify an/ `. g+ J3 c5 d( Q- T4 R8 C% r
### authz-db, no path-based access control is done." X8 Y& o9 Q) t2 U s* I5 e
### Uncomment the line below to use the default authorization file.
4 e; ?0 `6 {. Y, m) b: vauthz-db = authz
: {6 Y' A. d0 k' E, D### This option specifies the authentication realm of the repository.* O: y* h9 q& ^9 l% [0 Z
### If two repositories have the same authentication realm, they should
6 K) C+ x9 t' T7 j& r+ [### have the same password database, and vice versa. The default realm
* T6 M# p- E, @. b2 A. h### is repository's uuid.
2 _" X1 C y5 q( |- erealm = My First Repository! _: m& O" j- M5 Y& W! r
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
" V. j/ J' X4 l7 z2 S# p, M% w5 x9 R #killall svnserve //甇
! R- g) b$ M, e# Z4 ~5 j 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
% N( s# n; s# n( J$ U% B 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
# x- i6 T+ ?% R8 B! O+ X& k b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
4 Z: z- l; F8 e& S5 ?& }: t2 vexport 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" :
( E- z' Y7 k; p4 Y#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
t2 I' i6 j6 ^2 ^+ W+ q; O瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
+ N9 G) O$ u r0 {) g" N$ e7 x& Wvi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
5 T- w u7 `- l2 p( T' o" I, }; p |