: http://blog.csdn.net/yanzi1225627/article/details/491236596 U1 F& S4 Q" B2 F3 {
% ?) K; A6 _0 l5 g9 Y B
格嚗剖遣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 cmake1 p& h- h" t) G9 P4 r3 d
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx3 t( S/ o- A: C+ W: b x
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
& L2 w1 P+ y# M) U2 h. 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. y% x6 M9 |! b8 p8 ^3 t
0 c) @9 W) G2 w4 ochkconfig --add nginx
/ a- w Z4 \ C' q9 x* L! v/ ]* x" O( l
chkconfig nginx on
& S' m1 {9 g; D: P 嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash. \) b: X% N. @, A; K: _/ J& p3 e
# nginx Startup script for the Nginx HTTP Server
! @8 w5 K# {* K) H/ h9 c) ~; c6 g# it is v.0.0.2 version.5 f2 e$ Y* x3 d7 X% P0 L3 Y
# chkconfig: - 85 152 T9 r/ d2 A% u; \
# description: Nginx is a high-performance web and proxy server.& i# Q1 p! b6 h1 p' c% H3 N! `; T
# It has a lot of features, but it's not for everyone.
5 e: c+ v2 [- ]/ @$ a( @# processname: nginx
. f0 l1 V2 `: i/ |4 Z8 O7 X* \( N# pidfile: /var/run/nginx.pid2 ~3 w. }- J: J/ {
# config: /usr/local/nginx/conf/nginx.conf4 K- Z& z4 j4 h( Q9 ]
nginxd=/www/nginx/sbin/nginx9 ^5 p1 t$ V9 [3 \: b! i5 q4 Y
nginx_config=/www/nginx/conf/nginx.conf
% e) u4 B: B7 e1 x# X+ a; {2 Onginx_pid=/www/nginx/logs/nginx.pid) Q; k- z$ V6 k+ j
RETVAL=0
* s2 `6 d. ?7 m% }prog="nginx"* i4 ^ w# h) m0 k6 a% |! s
# Source function library.
7 t& ~; K% [5 h6 ~4 L$ p% Y. /etc/rc.d/init.d/functions
- h ]7 R- H$ ]& V1 A. V# l# Source networking configuration.6 c! \. t" C! ^" d5 f
. /etc/sysconfig/network
, y" |2 s; b# P, I) J0 [# Check that networking is up.( l; |) r$ l0 ~$ x8 T% A
[ ${NETWORKING} = "no" ] && exit 0- A4 P. q, P# R- F/ e2 t/ b
[ -x $nginxd ] || exit 0
/ N: e a. S z/ W. m* F# Start nginx daemons functions.% I0 X5 D" R7 }1 v* J9 Q# N
start() {6 N$ K' o8 E- @) H# B" i3 d" O
if [ -e $nginx_pid ];then7 S& R* N4 m( c/ B
echo "nginx already running...."
9 ]6 X0 C6 O- E7 G7 Hexit 1
7 r* i4 Q/ I/ x' Zfi
7 C8 i# l+ E9 `echo -n $"Starting $prog: "
. e9 v8 ?5 L( I8 O5 [daemon $nginxd -c ${nginx_config}' L6 E# ]3 Q" l$ m6 R
RETVAL=$?
- d0 r4 c2 |0 @% F7 z* G4 F, [1 Qecho
! A( ], I- n- u& |* S3 `, w# q[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx# E- z; X% B' p3 {! y
return $RETVAL
: `3 d! a4 f9 _, m; s. N}
3 ?1 l7 C" |, q% ~' t: h2 ?! R7 ^: I# Stop nginx daemons functions.
; L l9 x6 Q7 Y& z- ustop() {% N3 D* i7 V; n3 i- B
echo -n $"Stopping $prog: "
: g0 w8 c$ i* U2 s1 |! s' ?+ ]8 U4 pkillproc $nginxd
- I* B6 j* P/ M2 h! g7 j% eRETVAL=$?
% \7 e7 K, s$ m! o& {& ^echo# Y; l9 ?) p& `, X6 B; g5 q
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
7 J1 L3 z, E4 ?1 X6 o1 t}
& p# ^ F. ^+ e/ ?( C& Ureload() {
$ R7 Z9 t8 E% `2 u& Hecho -n $"Reloading $prog: "
/ r2 E/ b5 n% d# D# V#kill -HUP `cat ${nginx_pid}`8 {$ x3 C7 p5 x. A
killproc $nginxd -HUP2 _/ E& G8 i5 o
RETVAL=$?
8 ?( L& t" _" z3 O$ M' v! _# Zecho
- \( T- \3 J9 q* ]% t" Z2 h* M% s9 g}
4 N! D+ P$ |% W# See how we were called.
* T2 {- u; i: g" ycase "$1" in9 z. _* h4 Q' _& i& X, E( M1 V" Z
start); o% ]7 O L1 ^5 U" ~. S6 d& I8 Z
start7 [. N4 r! `* ?+ H! j) y) [
;;- h G, X) ?' \; Y; [- b: T
stop)
7 R+ Z& C1 g* \* _1 ]stop
& e( h9 w3 b |8 u6 Q! V7 { };;
0 s1 K3 d, \: |; H/ Z, q* v6 v _" `reload)
/ y) T }6 n5 d: K' u( zreload+ Q8 g* \+ Y2 h, P
;;* s/ u; T: b1 T
restart)
# Y/ Z7 ?$ E' lstop8 R( k2 F' Y% x1 u% \( d1 C7 k$ B
start
6 G$ s& P. G: @, w6 L;;$ ]8 j0 F! N5 z
status)* i8 J B% {# @. M
status $prog8 |! u% \, u9 t2 n+ ^9 V8 @
RETVAL=$?
6 J+ K8 C. D$ r M1 q; A/ }* U;;
1 }9 A9 i! @: ?' w" n9 u*)4 F! j+ v2 M/ Q l7 T- ?
echo $"Usage: $prog {start|stop|restart|reload|status|help}", \$ s1 V& H7 H
exit 1, P% x! J, V Y) a1 z* o
esac. I0 m% d( ?9 E/ k
exit $RETVAL$ q& \9 r* J, K" h% Y
' ^" g( `7 m+ _4 S' ?8 \$ e K! |" @ 瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
! z) g6 N# h+ k* qchmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗& }" \) c8 b! |: l, h/ g' z
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
3 Y) [% ^8 R/ Q2 G. O; e$ b location / {1 ]9 h8 C9 f& P: q) Z
root html;* ]3 [9 n1 h _ d V
index index.php index.html index.htm;
4 u" v9 \8 |, u4 B) h5 A# P, ^/ W }7 @1 P+ E4 }; {' N
靽格嫣蛹嚗9 {" S1 m& n/ q% U
/ @1 F0 | W0 T
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
" o, ^1 X# `3 r$ T8 y. glocation ~ \.php$ {, @4 S k/ l8 h* Y8 o
root html;
( [0 K' V5 l" N8 x7 }3 b6 S& c fastcgi_pass 127.0.0.1:9000;* u E0 w3 z; N* o+ T/ l
fastcgi_index index.php;$ [ `+ p+ ~$ r: }4 J. e
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;/ V4 {4 V0 m2 T/ |6 f# s
include fastcgi_params;
2 g i) ]# }' p1 H5 f* D$ J6 G }/ W: G9 ~7 u/ \! x: g, j$ ~" y
靽格嫣蛹嚗; T2 P: U8 A) w* z h
$ `7 u9 V. I) i' ~ 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閫蝻拙僎餈唳桀嚗扯嚗
7 ]. U' Z. D+ i2 e#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
o% E% \6 @2 g5 V7 a$ B0 s2 {; s/ I" q) X, b, ^" |; A6 l
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏1 s/ h3 o4 d+ U% ]2 |% r! n/ K
扯 cat /etc/passwd 亦冽瑕銵6 G8 i a# X4 S* y9 }8 c$ K
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
$ B! P: ?5 c- Z1 U; [' R 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
) X0 N; s* q. t 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
! N) R" l0 Q2 Z8 O9 Gchkconfig mysql on1 ? t7 i3 | T4 L( c, ?
service mysql start --臬決ySQL
S: m. E% A6 _1 f! C 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
+ }" ?, r( t' f8 k7 P, t( H3 jexport PATH
- x/ c! W, }- e% x" J, D9 Q 靽摮source /etc/profile 扯嚗
7 K2 b; u- {( X" y' T4 Ymysql -uroot mysql> SET PASSWORD = PASSWORD('root');
`/ X+ T2 w& U5 l( E9 i
5 H& c7 [+ T# ^: \) u8 l, e7 x) a霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 2 m! N4 t: m. y; @
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 ) X( J: p/ `5 p- g$ B- B8 U: F
#./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嚗 6 b* W: ^- R+ I' A1 L/ ]0 l) d
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
# \6 `, e& b# Y% f; j* J9 D* @4 [3 D( I6 e
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
; ^2 o0 ]! A, ]9 D" A6 H- fCreate /etc/yum.repos.d/php-fpm.repo file and add:
% W& |; t& j4 g0 ]" v* Y- [nginx]: E. ]0 ~8 i" r
- name=nginx repo
; ^) Y6 B3 h0 v0 Q - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/) N; b( k! L; x( x
- gpgcheck=09 b& [' t9 B4 E, H7 L9 _
- enabled=1
銴鋆賭誨蝣
3 ?4 J* ?7 B+ j7 |. Nyum --enablerepo=remi,remi-test install php-fpm- S6 M# m, l, [7 I$ v
/ C4 O v3 k6 o6 M- k4 T: N: F' \4 D0 x; E# w" k1 _& p6 |
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
) W) }/ E& l, [3 h6 ~+ O 嚗yum remove subversion //貉蝸雿祉svn
7 i7 j: g) W. R # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
/ I7 ^2 C" d1 W% \6 q, ^ 餈# 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. z3 p2 r. _. E0 {$ D, K7 r* _
# harry = harryssecret# p0 \$ I; i; X
# sally = sallyssecret/ o7 R( a7 ^0 G, c) B* ?
wangning=wangning9 k; d8 m7 ~/ N! u l* s, O
yanzi=yanzi5 S$ G3 [* @; V) K7 O: |4 `) b
#vim authz //霈曄蔭
9 c* K9 z) }% M8 q[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
. S# r9 p1 w( K6 `2 lauth-access = write% J) @; n; ]7 b: \% |, W
### The password-db option controls the location of the password$ h% P2 Q/ R& l8 r% ?% E* }, D
### database file. Unless you specify a path starting with a /,# j$ ^& U" X* {7 N, H/ w
### the file's location is relative to the directory containing
* y" g" F2 L' l3 z; T U### this configuration file.
3 o7 Q$ H4 F: S$ G k `### If SASL is enabled (see below), this file will NOT be used.
: q+ X b$ q$ e0 Q, {6 _### Uncomment the line below to use the default password file.! B' H3 Q3 R2 D6 ]8 S
password-db = passwd* O1 |* t8 [( \; r' U+ B6 t3 t3 R
### The authz-db option controls the location of the authorization
0 ]6 @3 G* J) ~+ p. p! {### rules for path-based access control. Unless you specify a path
7 ?3 k6 d6 ]/ E0 t4 }### starting with a /, the file's location is relative to the the4 _ s* A9 O* I7 n. A/ o0 `, d
### directory containing this file. If you don't specify an
6 ^$ m1 O; u& E, a$ H ~) e### authz-db, no path-based access control is done.
O# h( P- r3 Y9 D$ s. x0 ^### Uncomment the line below to use the default authorization file.9 u% C* P% m# z* P& l2 }6 w) M
authz-db = authz
, a' x5 c* {3 D& b### This option specifies the authentication realm of the repository.
% K4 ^: T9 h8 z6 r: ]- F### If two repositories have the same authentication realm, they should" ?$ h7 a- C" n
### have the same password database, and vice versa. The default realm
1 v7 k$ ]# T; j! h### is repository's uuid.
. {, V/ d5 n6 j2 P7 {0 \ orealm = My First Repository1 ~6 ] N" F+ u8 z3 R: U9 s) F
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
% e+ F) J: \& _: G. c #killall svnserve //甇& Y; Z' v1 V0 b9 x; l0 C" Q! A
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx7 ~3 h# N* [4 n
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
6 h$ j6 c. ]6 E2 R b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
' s' m& F: G+ c$ W) 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" :
( J6 ?5 c" W* ]5 \5 k7 c, y#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
* k! v; C6 c9 }6 g( u' P7 w3 O2 `' X: z瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled 6 l1 X* t9 u& T" N( N1 }2 e6 Y
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿1 m6 o3 g! Q# S; g: a7 A
|