: http://blog.csdn.net/yanzi1225627/article/details/49123659
$ ]! Z+ S$ W6 K: Y5 d7 `( H, f: N
4 I. C; c" k, ], s+ \格嚗剖遣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
9 i" E0 c- c5 x' I 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
! j0 ]0 J/ i5 o0 @ 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
7 Q3 L- f6 {4 B7 H* y, H A/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 s' c) [7 U6 V a) J# P7 s' z7 n" P/ d1 m3 Z' p: {! [
chkconfig --add nginx6 l ?$ R$ G( B7 e. K9 k' k
9 a. H* b3 D/ l$ e* c- ~: }chkconfig nginx on! C! }: C3 m6 Q) u a! p7 }3 e. E9 r
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
* k& \# p' h2 y+ p( T# { G( a# nginx Startup script for the Nginx HTTP Server; f' J2 G, t4 A# b# |
# it is v.0.0.2 version.* K ^, x7 c, ]2 V' H4 e( Y
# chkconfig: - 85 15
2 z C9 t6 l* i" [ r1 P# description: Nginx is a high-performance web and proxy server.
3 z+ N, M _! N# It has a lot of features, but it's not for everyone.5 M& T* U5 V/ w" {6 B, z
# processname: nginx
) _9 w( u) o; T }1 W3 o7 f# pidfile: /var/run/nginx.pid
0 `; w5 s( T' ~, _+ d# config: /usr/local/nginx/conf/nginx.conf
! m2 C5 [) ?! `nginxd=/www/nginx/sbin/nginx1 P, s2 h- a+ M: @) a3 [
nginx_config=/www/nginx/conf/nginx.conf
9 \: \, f7 s+ L1 H4 k( H9 hnginx_pid=/www/nginx/logs/nginx.pid) N% p k: \6 ?( _9 u4 b! h
RETVAL=09 y. `# T1 X0 p/ t+ C' z: w
prog="nginx"7 e8 A1 O+ Q# [: t$ [
# Source function library.
" a! ?) k5 w: l. /etc/rc.d/init.d/functions
1 W' l- A' F$ Y$ s- h: \3 V9 y' F# Source networking configuration.
& v+ D: X ^/ { b: u3 `- c. /etc/sysconfig/network0 e7 r# V+ B0 ]4 w
# Check that networking is up.
; D/ @ g2 J0 f9 k: A7 `" O[ ${NETWORKING} = "no" ] && exit 0" c2 Q2 v( Q- C
[ -x $nginxd ] || exit 07 U" ?2 t# v6 R, `
# Start nginx daemons functions.
4 [6 H6 s7 n* _2 ?+ \start() {- Q0 k* N4 k( j2 r, H
if [ -e $nginx_pid ];then
) |* |$ ]) X B# y9 wecho "nginx already running...."
, w& f4 S, y3 u5 r* W. |/ ~exit 1
* {$ {& d- G. S0 o/ d( y4 L: O; yfi
5 u7 G' F$ R" E9 d. g hecho -n $"Starting $prog: "
! N/ u9 n& m% o5 w. {/ cdaemon $nginxd -c ${nginx_config}
6 }0 G/ [; @1 {RETVAL=$?% n6 v9 n5 i+ i2 c# a
echo. ^( T5 P7 T) Z$ Q0 ]8 N5 X
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx8 u& y: S5 V( X; M
return $RETVAL
# [9 L# F. K# O}1 ]2 j* a" S' w8 c/ N+ z- c* I2 C
# Stop nginx daemons functions.$ t9 Q1 e" G5 r
stop() {: n# F: ~1 k1 c# A
echo -n $"Stopping $prog: "1 M9 z; \5 `' V9 b
killproc $nginxd! z3 O$ g0 j% B, q( H/ P
RETVAL=$?! {7 C0 f) A- ^/ t7 I
echo
2 `5 r$ r0 j, r* P[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid0 b" H0 \9 J6 z+ i- I
}" v+ T$ v r1 m' _* T
reload() {/ H7 ^$ _% b: U" |4 i
echo -n $"Reloading $prog: "
6 `: H( \- ]! G4 [: Z, s) m4 [#kill -HUP `cat ${nginx_pid}`
/ z# U) {4 O# k/ Y# e% ?2 fkillproc $nginxd -HUP% m- h3 |& }( o
RETVAL=$?% d) x6 z: H. M: n a
echo
4 g! ^9 |1 M! z9 N+ g! G}8 H6 S" f% F" w
# See how we were called. g0 w& S2 _8 C# ]& Y6 ^7 ^1 j
case "$1" in
$ B {! a& S7 c4 O& Rstart)& v! M! f x, _* y0 L' V
start
: ?% k( o5 S; H' m" K* s* \;;6 a: p" f# M/ `2 V0 f; Z+ |8 x( f% H
stop)% F1 c: F% Q$ s2 j" D& P
stop7 P3 n' k# k3 {# b1 s% C( P
;;! T! y1 I5 \; M3 f1 O
reload)* p% h8 K. l U: F3 i4 N
reload
, `8 U5 g% `( G$ U;;4 W4 p4 H; b8 P1 K
restart)4 W& O% [6 `* E2 q* U* B0 v+ k# l
stop
1 y! n9 @4 l5 L1 O0 f, Vstart7 w% i) G2 X5 p
;;, A( y5 q& ]+ [& E( ]9 |
status)( I: e" T0 b/ R2 P+ w6 T% `7 m
status $prog
2 ]7 Z7 ~& W" q! N: U6 C9 F% rRETVAL=$?
+ I. U, k# d) x2 K$ n9 p9 _0 X;;# K" Y) z! R+ d! b7 x" h& T) H
*)
' N9 I5 t% F0 i% _echo $"Usage: $prog {start|stop|restart|reload|status|help}"0 ?* E- [1 k6 g; l
exit 1$ @& X& k5 Y7 f2 N
esac
8 n. `3 g' g* y' U7 _* B8 rexit $RETVAL
( U0 T! @5 {; V1 D- A9 E0 y: Q E7 P
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 * s. G o; n% Q
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗3 C+ G6 c# y+ [& w
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
! l$ w) B' D3 u1 ^# T location / {
+ ? X0 ?! U7 r( `2 S7 x, r root html;8 a6 N+ R4 y9 C$ m
index index.php index.html index.htm;
. T! h, E) I$ ]0 ~. S% z }2 h' z- |' T5 `6 [
靽格嫣蛹嚗9 }- @4 S: o% d1 g
: L |: N. b/ X5 ]% k' H3 R3 _3 V
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 3 s: M5 v0 O4 @: V7 S$ \7 ~: t
location ~ \.php$ {
0 |7 C' \1 W9 c0 D/ {7 ?9 o root html;4 I. N3 Y& L; \4 Q
fastcgi_pass 127.0.0.1:9000;
$ Q# l- t, I* k5 ? fastcgi_index index.php;) ?5 Y% g' r" H$ y, Z- a2 Q j1 i
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
p; x8 \+ u4 Z& d" A* W include fastcgi_params;
* d* e* ^3 _* ~9 Y u0 b" ?0 Q }! u' X) P* x; H6 x! K1 \( y
靽格嫣蛹嚗* F% @7 ?- w5 h& p% U( e. O( Z
) y8 h7 P; u3 \$ y- o \: o 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閫蝻拙僎餈唳桀嚗扯嚗
: L' P3 P' n, V S% F8 E! 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! K& M% R( q% n
3 `7 M7 D0 S1 X; n% q
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏+ R( y6 @! \7 i/ p8 f
扯 cat /etc/passwd 亦冽瑕銵) {, y& c: F8 x ^( P" S% F4 P+ V
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
5 D7 ^( M. y" o 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql
2 [: p/ G9 e: M" s. M) g9 M 4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql6 X6 N" K* ]+ I/ L6 h
chkconfig mysql on6 s. G1 I& P2 y0 `
service mysql start --臬決ySQL
2 [# q' ~3 ^& Q! D 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
# T& S2 ^ m9 f9 ^, j( s5 Wexport PATH% n6 n9 m7 A+ W, R) F( q
靽摮source /etc/profile 扯嚗 ( a% H9 V& y0 W" l# p2 \, T
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
" d7 |5 r; g% L+ t2 r0 M. f+ b* s6 g. ]& U0 Y% L3 [
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
) a* p! X; \ u+ r+ z$ }( t0 fmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
# B% c Z9 n: 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嚗
1 D4 B8 f: Q7 `9 E4 bPATH=/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.rpm5 g6 k0 ^& \* s9 k+ B
% _8 k& S* E1 \: e+ z2 O8 t/ \
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm+ \. _/ k V+ K; Q$ t. Z* I
Create /etc/yum.repos.d/php-fpm.repo file and add:
, B( ?; v5 I7 m5 x$ D7 T3 E; R; }2 J" }- [nginx]* E8 @+ l# \% A5 X* Y. A" Q) k& j( k
- name=nginx repo
5 j- X0 Q+ r* K( v/ \ - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
' ~0 h6 B3 \: L7 w6 ~2 L% P& h - gpgcheck=09 Z/ A9 d4 G' f/ \+ t/ N4 N
- enabled=1
銴鋆賭誨蝣
, U' p! j# b+ w& S8 f* byum --enablerepo=remi,remi-test install php-fpm6 a* G. {, E& p% \ ?
. o' s i1 F* ]6 e0 |. u# |" i5 R8 I4 ^; \/ B
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn, @, j: T' z) W& ]
嚗yum remove subversion //貉蝸雿祉svn
! S8 G* D, ?, b: j# ~0 L- ^ ` # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn8 I5 B0 c. E3 z! B" t3 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]
/ x" |% d0 c- U' |# harry = harryssecret
; R$ @" R6 B) A: g# sally = sallyssecret
, B8 D$ m* H) k( }1 Z" Y9 x Kwangning=wangning: ]' S5 _$ r) i4 M
yanzi=yanzi; B# ?% w6 Z' t0 |5 J' I; Q
#vim authz //霈曄蔭 6 {, G9 h! K6 ?1 l7 M) ` b8 g
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none9 ?2 o& H7 c; E( k9 k
auth-access = write8 |. z `4 M& i' X6 @6 s) U1 H. K2 |
### The password-db option controls the location of the password
. k) [, v4 V x* D- l; T' z: }* } T0 c7 d### database file. Unless you specify a path starting with a /,
2 i# {; F: w! p6 N### the file's location is relative to the directory containing
4 G; B2 o: S# l, }### this configuration file.
0 ?4 Z$ j8 V' k& W1 S2 y; k0 N### If SASL is enabled (see below), this file will NOT be used.
3 L7 X1 e6 n: ]6 e### Uncomment the line below to use the default password file.
" l e- E# [/ ~9 P1 Vpassword-db = passwd- D- v8 B- c4 |: e8 U
### The authz-db option controls the location of the authorization
# A& f5 ?! L+ j6 Y" ?. v/ Q### rules for path-based access control. Unless you specify a path
4 i A* p8 ~. N4 C: Z/ k### starting with a /, the file's location is relative to the the
) [ _; ]# {. t8 I; V2 D6 |0 p### directory containing this file. If you don't specify an
+ q' O) T8 T6 @) l# R4 I3 D3 P### authz-db, no path-based access control is done.
7 j- ^- M5 w3 M+ B- @### Uncomment the line below to use the default authorization file.
# Z! X0 W& w: M9 F% j2 o$ bauthz-db = authz8 {2 e0 q9 N- K5 `; ?& @3 B' [
### This option specifies the authentication realm of the repository.& O3 W0 e: J" G* L" n8 x+ `
### If two repositories have the same authentication realm, they should
$ N; m! W; D1 ~* N### have the same password database, and vice versa. The default realm
j$ x1 O6 j3 J( J0 E9 Y! L; e### is repository's uuid.
6 t' _' p2 N4 Vrealm = My First Repository
; Z% {& }& x) T0 ] 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn) |9 C7 s3 _0 D5 ]" }( E
#killall svnserve //甇7 E9 V8 Z; z, z1 B7 r: e- u% V
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
7 Z( M$ P6 @ |5 `- ^* _ 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
2 U. h. B* k5 x" ~- y0 @ b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 2 k% X( j, I/ O
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" :
" ?( Y" I4 Q5 G8 {$ P#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
; w1 R" c6 V& _% Q* t l瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
( ?2 p# F$ ~1 K& h+ O" ]9 Nvi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿 E1 z$ E7 u J! o7 \' s
|