: http://blog.csdn.net/yanzi1225627/article/details/491236593 o! t7 N1 x* \! d
, f! g, `$ L+ N& Z) O格嚗剖遣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
4 S9 g6 W2 }4 }; r, E 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx$ H# t% U5 K2 C, E- d5 E
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www9 |/ L/ V9 a$ W2 G' O( ? N
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx) C1 S [8 ]6 d3 Y3 g3 Y
9 a, g# V. }# s! m! y/ ychkconfig --add nginx+ \4 ]) H& ^9 K* g! f
B" {+ f9 q. R5 ~' E2 Z1 R. Achkconfig nginx on
q+ W2 F$ K" F' k/ B; V; w) n 嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
3 l: h4 O- G$ `/ I4 t% g8 A& a# nginx Startup script for the Nginx HTTP Server
: O! a; I ^. P' T) }0 t2 U& R# it is v.0.0.2 version.! d, @+ t9 e$ u3 Y" r6 _
# chkconfig: - 85 15
7 x8 O2 y2 X* D5 u1 |/ p# description: Nginx is a high-performance web and proxy server.
$ p3 ~% J) }8 W$ g/ \# It has a lot of features, but it's not for everyone.5 \ s- h- f/ q7 q, ^2 P$ p' v
# processname: nginx
: D, R1 s1 ]; L8 u+ H" r% d# pidfile: /var/run/nginx.pid- W) b/ C. b2 K! [
# config: /usr/local/nginx/conf/nginx.conf
: M0 } R3 ?2 i: E' a2 `' g$ anginxd=/www/nginx/sbin/nginx
( b4 ]9 P0 Q9 z& Q+ q f8 H8 \nginx_config=/www/nginx/conf/nginx.conf3 _+ N9 r$ t# R9 j, G* s8 Y# l
nginx_pid=/www/nginx/logs/nginx.pid
4 ~( R7 X; Z3 {3 ^' N5 g5 [RETVAL=0% Z6 v4 v/ }/ a# j8 B: R' q
prog="nginx"! k7 }9 h. |6 E
# Source function library.
6 p) R* o3 @) Q9 @. /etc/rc.d/init.d/functions
; [* U: ^# D0 l3 c# Source networking configuration./ W! s. V+ v; ]
. /etc/sysconfig/network* |/ D _2 Q; q) W) s
# Check that networking is up.1 R2 I" q! @& e5 g1 g, e; A
[ ${NETWORKING} = "no" ] && exit 0: B6 L7 S4 `) P# V
[ -x $nginxd ] || exit 0# m2 I& u/ `" {
# Start nginx daemons functions.
+ g, b5 n, i5 L% S8 j5 Ostart() {# o+ T1 Y( U/ g f$ f1 U
if [ -e $nginx_pid ];then4 X; [; Z7 s( X% d+ a5 ^# a! ^
echo "nginx already running...."% s8 M% Q8 b# d% \) `, [
exit 1# n7 Z) {& p0 c' a1 K
fi" l' a) A: f: j4 G: z
echo -n $"Starting $prog: ": x s8 u3 o) [
daemon $nginxd -c ${nginx_config}3 L* W1 }+ z$ g1 c
RETVAL=$?: [+ n& M( T4 a3 _
echo
7 J- D: D2 N1 R' C8 r+ S3 k" g[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
& d8 R) F& J: n2 A. n+ creturn $RETVAL) Q1 f `" s6 r
}
. U' W' g% E1 C2 j# Stop nginx daemons functions.
5 B* }: z# D: |# o4 wstop() {" ?- A K# t0 |4 |
echo -n $"Stopping $prog: "( Q2 b: x5 d1 {, S1 A' a, L( D
killproc $nginxd
3 d% Q l% s4 F6 G( J) _RETVAL=$?0 K. H: F9 z& F
echo
+ l3 ]# k ]# p[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
) A8 }7 f0 ]4 e% |! v}* A3 C# ]# M( }
reload() {" }2 s7 x$ k- F$ s
echo -n $"Reloading $prog: "
- N. d$ Y! G9 t8 R$ |# _3 u#kill -HUP `cat ${nginx_pid}`
: Z" r5 X; B% k, i# k' Qkillproc $nginxd -HUP" s3 z7 L t2 _5 G* E2 R: A' j0 `
RETVAL=$?' O7 L6 E0 d5 n
echo3 x y5 r) N9 l" u
}
" n3 P2 m1 p" S# See how we were called. @2 s# U0 A* ^: Y
case "$1" in# w6 y! u: V0 T. E
start)! Q! i, @9 r# d5 K5 s
start4 O2 U" Z B0 k3 A
;;
/ i- q8 V# o$ m) ]3 b& i6 kstop)
1 V) |" s* A' M/ q6 bstop- C& i! i% [% ?5 C* W r
;;
. T" N% ?0 A1 K3 L2 S4 L }reload), ?- ` Q/ q4 r$ |- |+ E2 E8 H
reload7 i, i. h' I. f+ D* i: y. V
;;
6 q& |* p \' Prestart)1 q) N- c# O* k" t3 Q
stop
" g9 v0 v& i0 j* Lstart
5 h" }9 F/ p) G' k; N k;;6 X/ J8 D$ z! b8 z# X3 Q) }: y$ b
status)6 \* s- j2 n( ~5 }9 K3 ?2 c9 U$ c
status $prog
1 ?0 t( A/ L" {4 |" WRETVAL=$?
; F: n% z0 O% w;;
0 ^, W/ [6 Q! R& }- Y4 K*)
* V1 E) p& E2 K0 r& y Z+ r$ s" v/ oecho $"Usage: $prog {start|stop|restart|reload|status|help}"
* ~6 ?3 l) q V# e9 o- L( T8 r0 zexit 1
* ]9 y) {/ }2 H4 f/ }+ p9 c% [esac8 {- t, g6 Y9 ^1 q7 Y. o1 O
exit $RETVAL+ ?4 c1 Z/ S0 D3 W2 P0 Q- k
7 b3 L& a: L# S5 C2 J. ? v
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
- y9 Z. A0 X! p, \chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
. U8 l! i7 J) b, Y' P1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 1 ?$ R" X8 J! r/ f
location / {
. y# v- _0 S2 Z, a& T4 g$ ? root html; k0 I; ]$ R+ q" w/ t! `
index index.php index.html index.htm;
0 d$ l$ E8 u( ] }" q( x4 f! n% I8 o& a
靽格嫣蛹嚗5 G4 J: k0 f% r: f
- W. p5 ^. Z, Y' Y N" p
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
4 l" _: H, X7 J; L5 V; Qlocation ~ \.php$ {
, N5 f2 u! x) Y, }+ ~ root html;
4 g1 G$ @; \/ K" ^' ^ fastcgi_pass 127.0.0.1:9000;! |6 m1 m+ _% X2 g7 u4 R
fastcgi_index index.php;9 j7 l6 c( c9 ~
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;: ^9 Y8 Y9 f% y% t$ S$ u3 c
include fastcgi_params;
! k0 d9 y1 p. ]: Q% A$ ^ }
- y( ~7 U4 A+ ?$ W. s7 X, z1 Y靽格嫣蛹嚗9 r$ s1 K$ k) \3 `/ s* j: L
2 z/ H* {) 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閫蝻拙僎餈唳桀嚗扯嚗
1 c4 [6 B# w& f# t#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql. k4 ?0 ^" @! ^+ F7 ]
. J2 p3 N: j) S2 l
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏
4 l6 ~9 P5 |) u& c 扯 cat /etc/passwd 亦冽瑕銵
+ E( j5 c6 y$ Bcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
7 Y& p; D4 r- ] |8 T, D4 Z4 `! @( @6 K 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
4 J$ }0 W, l" [ 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
/ ]" H+ H2 U4 H9 b+ K% X# b1 echkconfig mysql on
9 p2 H( g0 | J8 z, s1 S& eservice mysql start --臬決ySQL6 a, P2 d( j4 d% D
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH b. R" p6 U1 d- ?- c2 J* \* A
export PATH
* E6 q3 {; }1 T* }7 B- u 靽摮source /etc/profile 扯嚗 ' i- Q4 d( |% l- g+ X; q
mysql -uroot mysql> SET PASSWORD = PASSWORD('root'); s4 t& }- q5 @! @
6 d. o& J# ]1 v/ O8 f# ?: X霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
; O3 N- \2 T8 x) X. h1 X% omysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
9 l, {6 B7 f1 a. o#./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嚗 3 b, P U+ B- k' ]+ N/ o4 c* g2 i
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.rpm2 A$ y+ s+ g8 W5 O
. u; N, ?8 U" w+ i1 erpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm6 Y+ D5 c3 ]2 w- s0 ?. G+ `) l
Create /etc/yum.repos.d/php-fpm.repo file and add:
1 f- M, t% B9 `2 X' v0 y- [nginx]
, k# ~* d9 _8 @8 |9 I" y4 L - name=nginx repo
) U& V' D0 Z( Z+ j% r - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/: L3 A% m. ]: x4 q/ K# S
- gpgcheck=0
5 j+ U7 s! G3 J- X0 f" C - enabled=1
銴鋆賭誨蝣
8 s9 {/ z! h' `2 K# Wyum --enablerepo=remi,remi-test install php-fpm
+ |! x! i8 M+ H$ s: I$ D
2 H1 P. ?9 S# ^% W! |& P3 [5 Z
( I8 V( ^- V3 t) C% y鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
. D5 K' O7 U& F. ^( [0 O 嚗yum remove subversion //貉蝸雿祉svn& P; ^' r" \" Y- L1 R# f
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
# o, a" Y7 e& N- X" C0 j* D& ] 餈# 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 e i' S( q1 h+ U2 x# harry = harryssecret0 S4 e; v3 F. b
# sally = sallyssecret$ Z0 Y3 s$ J/ }& Y& b$ _$ i7 y
wangning=wangning9 k& M* j+ M$ ^$ @6 [8 E) t" g
yanzi=yanzi% x7 `7 z# o$ a' Q3 `3 M
#vim authz //霈曄蔭
0 E! C: m* b& A' D; @[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none- Q/ |: J3 `, u4 T5 J# f- E! k
auth-access = write
" T1 D. i. [* v9 x### The password-db option controls the location of the password
6 v' h. h5 {( y! A+ P! B7 i### database file. Unless you specify a path starting with a /,+ D* V* @; i a* @8 u
### the file's location is relative to the directory containing8 Z# j5 N! o9 V) |8 V) S* D
### this configuration file.
! k$ S0 r2 v4 A- n8 t( o### If SASL is enabled (see below), this file will NOT be used.
) J, \" j+ f, [! W6 v7 b### Uncomment the line below to use the default password file.& `9 V2 w4 ` o5 z5 o, k
password-db = passwd
, R: a3 a( ^0 f5 r2 z$ E### The authz-db option controls the location of the authorization
" c0 {$ M& n" f$ B### rules for path-based access control. Unless you specify a path
` I( x9 ]* j( B: ]& i9 I2 B### starting with a /, the file's location is relative to the the
1 j! G- K+ B. m: U- B& D### directory containing this file. If you don't specify an
2 s6 ]4 u/ n) z### authz-db, no path-based access control is done.$ d$ |- q2 {% S3 g$ r( C. k
### Uncomment the line below to use the default authorization file.
' l, `4 o- T* ]/ o" M% tauthz-db = authz
7 Q* e8 @+ G5 _2 b# G### This option specifies the authentication realm of the repository. Z7 |% p7 g$ R3 ~, G7 {, y
### If two repositories have the same authentication realm, they should
3 ^' m7 t% ]% m### have the same password database, and vice versa. The default realm
$ L) l0 |; {$ {) R' |7 D3 ^### is repository's uuid.
# G3 w6 {( h9 crealm = My First Repository3 v/ q" p- S3 a6 o
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
* ~* _0 }! O7 W+ h8 g) _ #killall svnserve //甇
7 P j( d! ?; Y: D9 I 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
( |( ]0 k, `3 |- x; M# q$ m9 z! V8 V6 t 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/web8 f$ f, N; l5 Z/ ?% N L
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
" ?$ s' y, Y0 i2 @0 w+ {) z" kexport 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" :/ f) t) n/ | K) \) V! `
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 ( f2 | F$ `* G0 G- }& `& ~
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
7 A1 N" O" B" D. i5 Z2 B- ?vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
3 M' l% V) y/ E$ E- n/ V |