: http://blog.csdn.net/yanzi1225627/article/details/49123659
" ?3 A: r# u' [+ C
; {2 C, x) _/ Y& F" 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+ e% |+ F: n+ c2 |0 U! }% F0 B5 w
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
, H2 o* a( ?7 I7 Y% W7 s) s 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
8 v G2 S+ H8 [! n; 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
( _8 T" S3 c- N
$ _9 l+ q u5 d# x: pchkconfig --add nginx
+ H2 v+ a+ n" V7 L$ h
% ?) y$ T1 q5 \' _& l- Gchkconfig nginx on9 B% L! b0 S: w5 K- k7 v0 ~
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash; c; `) A3 C- Q. H7 q4 _9 h
# nginx Startup script for the Nginx HTTP Server# d7 ~1 X* o( y. |$ _! M9 H2 Q
# it is v.0.0.2 version.
1 j+ h& ^9 E% S9 s1 G+ P f0 W# chkconfig: - 85 15
; J# z, ^7 s( H# description: Nginx is a high-performance web and proxy server.2 m* w& e& R1 }/ x( R; p
# It has a lot of features, but it's not for everyone.9 d6 x; s1 d1 i4 A1 X
# processname: nginx9 M6 y0 U! w% S; \' v
# pidfile: /var/run/nginx.pid
; g* ~4 A( a2 J: v4 \# config: /usr/local/nginx/conf/nginx.conf: L8 a6 }3 L* u1 A; J+ t
nginxd=/www/nginx/sbin/nginx
/ ~2 @3 V" @' }% Knginx_config=/www/nginx/conf/nginx.conf( Z: b1 |' [ g, p9 ^ p; w
nginx_pid=/www/nginx/logs/nginx.pid
+ n" \' K# ^7 I7 G1 O, WRETVAL=0
2 h" I# D& k- u0 {0 xprog="nginx"; o% t" I6 y+ ~* C8 G- J
# Source function library.
/ E2 Q+ [3 ?: p$ Z; X. /etc/rc.d/init.d/functions7 E" E8 P4 k& H' ?$ x+ B
# Source networking configuration.- Q0 }( ]9 ]9 @; h8 O
. /etc/sysconfig/network" L7 g. |$ h# Y2 P2 u
# Check that networking is up.! D2 Q" P$ b2 k3 x
[ ${NETWORKING} = "no" ] && exit 0$ [1 M$ p Z0 M( S( ~
[ -x $nginxd ] || exit 0) j' ?8 g. j; i* b
# Start nginx daemons functions.
8 Q7 w* V7 ]. E0 E4 q4 A+ X/ y, [start() {
) Q" ]4 [3 K+ Y. k) W% lif [ -e $nginx_pid ];then
5 W; }1 F% J) q( K' t" necho "nginx already running...."- [6 K- f/ P9 J. S
exit 1+ f$ J3 J( ]) a) ^- {; x3 A
fi
* W" s: D7 `3 mecho -n $"Starting $prog: "
2 x# x! ^* f8 a/ x( Idaemon $nginxd -c ${nginx_config}
8 f; l$ `7 |8 L; f( J$ [RETVAL=$? B1 O! N- b/ C1 N
echo
1 T0 A0 ^$ ^8 X8 Y9 I& b# F[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx$ i. |4 J7 `5 f
return $RETVAL" T3 x. V L) m* i& j* O
}5 P* u( x. g9 z: P! O3 F
# Stop nginx daemons functions.+ i6 }/ e, [4 k9 r; H2 N# I0 i
stop() {: l. w: I: D4 Y5 n. f+ m2 ]
echo -n $"Stopping $prog: "
. m( u8 s( X' R+ ~9 s2 I5 {9 X1 H8 Lkillproc $nginxd
7 l: U) R+ D# t$ K5 t eRETVAL=$?# W" a, c( R) o& g
echo- G+ [# m# U2 C
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
3 O: X% R& v8 L# `. f+ I1 @}! `- O% F: F1 J
reload() {
) {, k; R/ N, w7 `! w) ]8 Mecho -n $"Reloading $prog: ". f9 j2 u& z, i1 o4 ?3 i
#kill -HUP `cat ${nginx_pid}`
/ j9 n3 B8 r& k$ }2 _killproc $nginxd -HUP
/ Z! E2 w# b; q+ n4 n; E: bRETVAL=$?0 p) W$ ^7 Q6 r- Y4 i
echo
4 g9 Q0 @4 p" d; p} A9 U8 |' Z# r3 f- R) M8 l, G$ A
# See how we were called.0 K6 o- ^$ z, }& Z+ R
case "$1" in
# c2 t4 G% ~- h$ {5 ?1 P+ l# R' Kstart)
6 Z9 w' Z" V' I0 K+ O2 Qstart
, A0 \* r `' j& g) p9 H& ?;;
! B3 S3 K! ~5 W& w5 Mstop)2 I E7 z1 K5 Y) W2 h
stop0 |) R7 b0 g' n* ]/ s1 H+ N
;;: E: \( G3 r9 y8 X
reload)
0 z3 u% v0 Y% f1 x8 I; r1 A* N3 xreload! m0 @1 E9 [2 H
;;
1 X" t; _0 L r$ V, G# o9 }; L, ~3 H# _restart)
1 j y" s0 G+ ~! bstop1 L, u$ F5 k; q4 c; `
start1 R# {, S, o$ v# m, L
;;
! W! v4 H0 S' E) |9 F9 nstatus)0 x0 Z5 b+ X* {0 _
status $prog2 H- K. R k6 I" l) D& ^/ L+ g
RETVAL=$?$ ?3 d/ y, G" y0 S- ^" E% }, @% m% T
;;$ W( g) D; R9 U- J
*)
. V C7 x# G+ Y9 Q8 `* i* E: jecho $"Usage: $prog {start|stop|restart|reload|status|help}"
; A+ p; D- R4 S* gexit 1) u" { `6 Y5 K# S1 O0 P, c
esac
: F5 K: d; D9 M6 jexit $RETVAL, G7 ]: @! p' e& K0 ^* M: h
" _& ]) i0 \% E6 O! K" n+ p 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
' M# @; O% _* B; x& {6 V# rchmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
B6 i9 s/ t3 j* i1 `1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
: o/ `4 o7 d4 {0 x1 D* |% y& e m% E location / {
: P, d3 T `, A+ Y; b/ f root html;
# }6 U3 {3 ]& C' p index index.php index.html index.htm;* t8 e& K7 F, ]8 `- o1 ^
}1 W1 M3 ?& x9 P$ I3 V
靽格嫣蛹嚗
( P5 y+ z/ |- C1 l1 E) M7 i, u0 w7 F5 |
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
0 i2 D% A$ {# \location ~ \.php$ {4 E+ ]% c' p2 C& }' [
root html;
, z# A" L2 C% o8 e. |9 V fastcgi_pass 127.0.0.1:9000;% g# O8 q; g* F5 ]
fastcgi_index index.php;
4 V8 R, ?9 B; ` fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ O; g, z# G4 ?6 q" A1 k. w include fastcgi_params;5 R7 ~7 W' N2 r% G
}
- z* i4 v9 e8 Z! |0 a( d靽格嫣蛹嚗
6 _" S- u! N/ H% m4 `, y1 b! C- f u6 p+ i" T2 G
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閫蝻拙僎餈唳桀嚗扯嚗 $ C4 S3 x0 d* i* G- R
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql0 e% w3 f, t) B. Z
' _4 S H) C4 \' l* `3 d4 L
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏
9 G$ ?( z# P x. t( X; O# Y 扯 cat /etc/passwd 亦冽瑕銵# J% b: \% S+ E0 p, O+ ]: t
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
" _- F4 {% ^; | 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
# k; S# g2 g0 v6 B7 ] 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql \) @* f9 y9 N9 W
chkconfig mysql on
; @+ E/ _2 z& z" ^4 z4 gservice mysql start --臬決ySQL) U n) d& u! p2 ]( f" `' D/ z6 |
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH3 g6 \ S, ?: a2 O2 n; ^
export PATH8 C; I: f' t( i3 L1 h
靽摮source /etc/profile 扯嚗 ) J* b D8 R' Y, h2 N4 g
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
- N6 B* N5 G0 p+ D: [
' z# D3 o/ W0 e0 `: q霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 5 B: g9 v% k, Q% A' r
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 5 ?" [3 T- f+ d+ y: c `
#./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 o4 s* @+ d* H! x" 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.rpm
1 b# G, d$ q1 W; K/ o' x+ q3 w
* L+ o/ J/ n# l" s' {; R7 Brpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm0 g0 r! V- Y& f$ \7 E) b
Create /etc/yum.repos.d/php-fpm.repo file and add:
8 X- r& t O: Z( J" Y% O: E2 J- [nginx]( T3 B. g h# Z. _% h
- name=nginx repo
& E4 h( k3 O% g! v1 J2 F- Y+ D - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/+ H& f g& g& |6 h) P2 V
- gpgcheck=0
7 Z2 j9 j, R; k - enabled=1
銴鋆賭誨蝣 $ |& ]# K0 T4 ]- n6 V& @( V/ H" d
yum --enablerepo=remi,remi-test install php-fpm
' A1 [- _7 v) I. v+ q" G8 U, w( H9 q* |! w' ?! w1 e q9 D6 e
( @; A( \/ W4 v. {! _鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn; X6 |$ Q/ D. M5 @
嚗yum remove subversion //貉蝸雿祉svn4 U# V" `" s; z- o1 l2 X
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
9 H! C8 g9 A9 J* [: k 餈# 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]" {/ S: v Y! J% n& k, Q$ i
# harry = harryssecret- N$ V( i9 f5 M/ K8 d
# sally = sallyssecret8 B h) {2 m+ u0 i! m- Z
wangning=wangning
' c& O+ l* Y9 j, q) m6 I3 `yanzi=yanzi
( r$ I, B& @) ^5 J9 j, Q! b #vim authz //霈曄蔭 7 }; r: L( Y% M1 q/ ?
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none- Q$ q* t' r7 y9 U* E( Z
auth-access = write" z! g. D* u* K& ?; q+ m J' q
### The password-db option controls the location of the password5 j0 n7 a% e. d/ s" x
### database file. Unless you specify a path starting with a /,( Q0 @( i: D/ q* s9 r5 F. k$ J% z6 B7 Q. C- z
### the file's location is relative to the directory containing
1 b# P% p+ x, ] [/ j### this configuration file.% W3 c+ R3 G: s( }+ [. T( ?
### If SASL is enabled (see below), this file will NOT be used.
7 x5 r7 g$ F9 n### Uncomment the line below to use the default password file.
- n+ W! T6 V& n/ ~* h. q/ X# }password-db = passwd
8 W& L- ^3 R: f! @; j5 D* p) G### The authz-db option controls the location of the authorization
# z2 C6 T: s6 O2 y \4 Z### rules for path-based access control. Unless you specify a path1 i% e# _( b n* p" ?8 A
### starting with a /, the file's location is relative to the the
9 M) H+ G$ @8 J2 l* j2 h### directory containing this file. If you don't specify an. s0 \1 ^( F9 \6 x4 w
### authz-db, no path-based access control is done.
, G: a9 R4 c/ Y" Y4 Q" ~### Uncomment the line below to use the default authorization file.0 a) c$ Z% e, x& i0 p- O
authz-db = authz' z! N$ H2 O* ]6 b4 X" f" Z
### This option specifies the authentication realm of the repository.
8 t$ A, B1 ` ^! ?& `0 v9 `+ o### If two repositories have the same authentication realm, they should
4 i: p8 S9 ~+ K$ `; K6 Z( o### have the same password database, and vice versa. The default realm
7 ^- E# a$ ^4 s4 j% ?6 z" |' M### is repository's uuid.& K& w6 \ C% {) [! i
realm = My First Repository
7 J% l6 ?# y, D 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn" Q9 ^* Y J9 j
#killall svnserve //甇
' f/ ?) D8 `+ l" {2 Y- k- V 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
; f F2 j. \3 a 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: H7 m' F' f& r5 H0 g7 W' T
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 " u }) D: J6 ]
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" :
9 F) d+ }3 B+ C! w/ e: g#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
5 @) W6 A. B8 [/ t瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled " C6 `% o) u. d# K9 Y
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
+ O1 V5 J# F2 h+ c, Y+ K9 G |