: http://blog.csdn.net/yanzi1225627/article/details/491236599 i5 U1 q# V |+ B1 F% _& L
0 f$ p1 J% a9 _, j: c; B% n6 x格嚗剖遣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
$ K0 G* W* o# p7 c2 r: u 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx% M! U2 K! L2 n5 m, J
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www# q$ j K% o/ j) i- A( r5 D
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx4 M% u& Q5 ?* k A4 R
' r1 y; w) Y& j, S
chkconfig --add nginx' M" P/ x* x' S" c, m3 n
4 J. Q& f8 |- Lchkconfig nginx on8 J6 F% y( V4 f5 j3 V6 M/ z- K5 O
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash* v! x n+ q$ m3 G8 i9 R2 q
# nginx Startup script for the Nginx HTTP Server# |/ r g; U, e6 C1 W) _
# it is v.0.0.2 version.
& c" \( _2 G( w# chkconfig: - 85 154 T0 q" M4 }. |. C: x9 G
# description: Nginx is a high-performance web and proxy server.. Y$ r: v6 P- b( G$ V* C
# It has a lot of features, but it's not for everyone.
4 p' D/ v) }8 q" G% u+ v# processname: nginx" w7 L o! }! S
# pidfile: /var/run/nginx.pid
* p0 B% @; y' X3 K# config: /usr/local/nginx/conf/nginx.conf
9 P+ f, F( E& _. m5 Enginxd=/www/nginx/sbin/nginx$ `% j- U4 V6 |/ Q4 L3 d! I, u
nginx_config=/www/nginx/conf/nginx.conf
, }$ I; ^! ~7 D) R0 m1 C* hnginx_pid=/www/nginx/logs/nginx.pid" z" n9 r/ M2 x% M5 E
RETVAL=0
, `$ R: M2 M0 {prog="nginx"
4 F: p8 P7 Y- s3 q2 l# Source function library.; k" ]5 g- y- i5 H$ v! z- B! g
. /etc/rc.d/init.d/functions3 \7 [2 M* s) } }; X' `
# Source networking configuration.4 W/ E6 f+ |& w! M- Y2 A
. /etc/sysconfig/network- W, A3 O$ d4 B9 h4 C+ G$ ?% t
# Check that networking is up.
) @, l, Z9 l1 p. S- H[ ${NETWORKING} = "no" ] && exit 0
: l. {/ t, }9 {[ -x $nginxd ] || exit 0
2 O$ l2 f' M- ^3 s# Start nginx daemons functions.
6 ?1 r9 {# a9 \8 a1 |start() {
q, C9 q9 H- [5 |6 D7 g! hif [ -e $nginx_pid ];then/ h/ i% [; r( g: v. n( k& A
echo "nginx already running...."
% d2 @3 K, z3 F8 D1 \2 Uexit 19 {3 Q: [7 A. m1 }
fi* x# e; E! @4 y9 q. l
echo -n $"Starting $prog: ": ^! K8 u* y. n: T! Z& L
daemon $nginxd -c ${nginx_config}
: |; J' |9 ^5 E# ~8 A0 dRETVAL=$?9 v7 t4 X+ [* z
echo
) @( `& V p, V1 V' x( H; I% B[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
, F. N9 G& \1 o1 \! Z9 [; p" \return $RETVAL1 f# [. e; Z4 `7 t& N
}
2 ^3 R$ `! u5 S! L( \# Stop nginx daemons functions.
) }- \/ A$ t2 X+ B6 ostop() {
0 y2 y; F- p" f; O+ o& ]echo -n $"Stopping $prog: "
- y! }/ c9 W* C: e) H; N( Hkillproc $nginxd6 a& g) u) p3 q$ E0 b. }
RETVAL=$?
' u' r9 a2 D, d* O& Iecho) q5 E; Z, _7 X* J* B2 ?3 u
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid* W/ t6 b4 C0 W$ h
}
; e' M2 ^+ X0 ?& W; k9 ~4 n6 [reload() {8 R- _: M; l2 D
echo -n $"Reloading $prog: "
, a* t# w; ^9 i Y2 c. j# \- r#kill -HUP `cat ${nginx_pid}`
* z$ e* u$ i6 U! bkillproc $nginxd -HUP8 X! m- x: ` T& |- @% Q4 d
RETVAL=$?
' s5 b, l9 y, Y$ ~ O' Q$ G$ becho$ u- b6 \: t- E0 {* ^
}" c% ]& j# W J0 U1 I
# See how we were called.
- U5 v- v' F1 |4 Kcase "$1" in1 Y) r/ H% ?! _; E: z1 c
start)- c) H6 G r' Q4 x. K2 W
start( d* G& A* k: L8 @# W
;; c4 ^$ r. J3 v7 W
stop)7 u7 f# {9 i4 j' Y9 j6 b2 Z
stop) e8 ~4 V9 ^! i$ J: j1 J$ Q
;;5 W' Y. g# S+ w, \- N
reload)
7 ~ n) _4 z2 C: \6 _reload
$ b1 n. ~' M; \% K;;
& Y' L$ c( h' N5 ?9 G0 |, e0 Hrestart)6 r- d0 a, X( m7 S. n
stop2 s O' }/ s( v c7 t) h
start p% _% B1 s5 j% y
;;: X/ c3 w5 g) t
status)8 a- u U2 z( ^4 ^ O5 Z! H. [
status $prog! p5 K; U" s1 U% O) e0 L, j
RETVAL=$?9 L2 }4 N. t9 A% k. n
;;
7 k1 J: g' V5 Y* y( x" P+ i- [ l*)( b A m- @" q! K2 I1 a) P3 S. R0 T- Q4 X
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
0 \8 B4 A) v4 w/ ?# @# G9 r' J& Z8 Xexit 1
$ A, c; G8 Z1 |3 k& v1 wesac
; i4 ]9 N5 r7 [! U- Kexit $RETVAL
! P. M) N+ E" w) d0 t7 f
; G& L+ o5 {2 Y+ m9 I7 l0 i; \ 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
4 t9 e5 ~6 \! ~0 X! r; ^chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗0 a1 Q' ~- R' X/ k7 e" a
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 4 F7 T' p7 } F, s# g' p3 c
location / {3 R; b3 c1 S" a1 G# Z
root html;# e: m1 N! h2 ]9 D0 O& K
index index.php index.html index.htm;- ]9 y8 R# [7 Y0 |
}% S% \+ L" \' c) [
靽格嫣蛹嚗9 c9 }$ E) ^+ v2 Q- G \
1 H- g: V2 A% v location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
8 S3 @( r! y5 v/ ]& slocation ~ \.php$ {, s# }. k* T% J( Y) a. b! `
root html;* r0 |( C c* ~, ~9 b4 k
fastcgi_pass 127.0.0.1:9000;
% @# {0 R+ D- z0 R+ F, M5 ^: a6 }# j fastcgi_index index.php;
* g& [2 x- _: c% s: V' c/ K6 v: O fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# x+ ~# k# |1 a ?6 X include fastcgi_params;
" S( Y4 G0 J& n$ P% X* ~$ Z. q: S( p }
& W1 j! K0 u3 V; Y靽格嫣蛹嚗7 S( e4 M" F1 f3 ?( H
7 V4 @" v% `, Z
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閫蝻拙僎餈唳桀嚗扯嚗 0 A" l3 S2 l1 `/ o9 N
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
0 i, N% A3 i* ]3 n4 ^) n/ X5 A* \- l/ V1 I$ C% w" l# ^
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏$ G! Z8 M0 F) o3 n l* w% e
扯 cat /etc/passwd 亦冽瑕銵8 N$ ? H' w$ f; C6 E
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
; O3 W# M6 w1 I, s& j% n 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql0 ^! L6 N# V: T w5 ^. R0 M
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql6 Z# s& r/ X* G: i& f' y8 m2 Y
chkconfig mysql on
# z9 ?1 g, H& \% {service mysql start --臬決ySQL
h7 n+ A7 O! e8 X- i 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH2 T3 @8 B: o% P* _- X' U; C8 M
export PATH
. e0 C/ c& V3 V/ }2 D9 a! c 靽摮source /etc/profile 扯嚗
' @$ O9 d! ^; k9 omysql -uroot mysql> SET PASSWORD = PASSWORD('root');
. F" A/ U5 y1 q0 W
$ y( f9 z. O* _5 u* |1 _* w, O霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 + T, A5 h( K# g9 {' f0 c/ g0 Q# V$ z
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 + U9 c- ]: r s0 p, _
#./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嚗 % l6 C! T5 N% x R+ 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% k6 w, H$ U+ T, Y( U. j
, D: j3 Z5 X3 l6 \3 ^' G
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm- X4 d3 W# \1 [) |% |* q% C h# X9 F
Create /etc/yum.repos.d/php-fpm.repo file and add:
5 ] K5 k4 r1 n/ y4 R* S a* U- [nginx]
4 S% i3 J- u( J1 z - name=nginx repo
2 H; y" G" k# q; H+ e - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
; @/ @ u2 j6 _( ]* J' ~+ r - gpgcheck=0
" d" a* ~6 o+ U' o; p - enabled=1
銴鋆賭誨蝣
" t( W3 [3 f& k# q% c' ryum --enablerepo=remi,remi-test install php-fpm/ b$ V- l! U: S: h- J
& L R' z- j, L5 {
) ]8 h+ r. d1 a" E) p9 ^鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn/ n4 e9 b1 @8 i0 G1 A
嚗yum remove subversion //貉蝸雿祉svn! q N; T/ h+ ]* u2 t% T3 ?' F. {
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn. h u8 D2 i8 _
餈# 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]- ~ A6 F7 S) l8 x q
# harry = harryssecret
6 l- [- j9 d+ m* v }; W7 J+ b" N# sally = sallyssecret
# N# F; D/ M$ l& Pwangning=wangning
- ^/ n, s- ]1 r9 ?5 F' Hyanzi=yanzi! n4 a8 V6 T: P
#vim authz //霈曄蔭 , w: Q; i! _% G8 X* u; t
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
: D6 [5 L" Y" S* Kauth-access = write8 s( d3 f. R* S" F5 o
### The password-db option controls the location of the password
7 ]0 t) p7 V6 y, T, C### database file. Unless you specify a path starting with a /,5 k& [. h+ B* A( r
### the file's location is relative to the directory containing0 d) b9 S- o! s' \# B# I
### this configuration file.
. T0 u0 E% q9 _8 [$ H6 \8 \### If SASL is enabled (see below), this file will NOT be used.9 Q# S# h X# C# A ^& n
### Uncomment the line below to use the default password file.& f: t9 P; {7 q. w) d! M$ P1 I, T
password-db = passwd. u, f- ?( G, E% q& ?/ o
### The authz-db option controls the location of the authorization
r! h9 [! V, l0 I$ j9 U### rules for path-based access control. Unless you specify a path
" T$ X( O: u; I! [4 R) h### starting with a /, the file's location is relative to the the$ K- O( g- Y8 r+ n. K" a3 z
### directory containing this file. If you don't specify an! z! ~( g' w" F
### authz-db, no path-based access control is done.5 ^, X% r, y# h, v1 u5 K9 L
### Uncomment the line below to use the default authorization file.) l: R$ g) q3 F4 O& I5 E) N5 I8 A. J! I0 [
authz-db = authz
- [6 k/ I6 g. U' O0 [4 {$ b### This option specifies the authentication realm of the repository.
& W7 d3 D1 ^- N9 B8 F# D* K, m### If two repositories have the same authentication realm, they should7 V$ t6 Q0 u* ~" L d
### have the same password database, and vice versa. The default realm
$ a4 g$ A5 d, N9 O0 L### is repository's uuid.
% u3 }2 g9 c# s6 H: V% qrealm = My First Repository
* p7 s" S% h: a4 k( z 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
1 O" X5 B5 u9 w! Y4 Z/ _0 f; P #killall svnserve //甇
9 `" @! B, _% ]( t5 J& z5 s5 w' z 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx9 b# [7 m& {9 \$ b) V" u$ j
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 @, t, H5 \1 q- s. |3 T b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
6 `; O2 J- x( V. i! l3 Zexport 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" :
7 t& U/ t, D8 F* b0 Z4 E7 Y#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 $ q- d! j& Q& r, g( B9 t: ^
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled 1 B. Q1 g8 F- c6 P6 W2 ~
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿
5 O) S7 _) y5 O5 c% M4 G |