: http://blog.csdn.net/yanzi1225627/article/details/49123659
3 z$ g7 E. }7 O, w' K: ]' a2 u) n- s' Q7 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 cmake
2 V, H0 d8 q! J \ 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx9 @, D, o% _% a2 J
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
( A5 [; I: u7 J4 f. \/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx8 p7 o* `7 Q7 U& q
! y, y+ e* m6 d+ ~6 {chkconfig --add nginx8 c/ x, N7 e; J8 Z1 _
% M# _; {( |1 K+ U0 ~
chkconfig nginx on
% L6 } [& R+ I; v7 N2 W5 A" _: | 嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
& f) ^, x# r. E. B# nginx Startup script for the Nginx HTTP Server3 h9 b% l, j) o
# it is v.0.0.2 version./ v2 g. n" G# b! ^ O1 }
# chkconfig: - 85 158 Y6 f/ K7 o" P* Z: B2 m- Y) a
# description: Nginx is a high-performance web and proxy server.
1 A! L9 l" w r' ~* [# It has a lot of features, but it's not for everyone.
" u2 r! k# R, d) `% E0 @6 _# processname: nginx* I7 I/ u i+ ?" _* W2 ?3 E
# pidfile: /var/run/nginx.pid8 V9 r& Q8 `- z* {. W3 `' o+ N
# config: /usr/local/nginx/conf/nginx.conf
, Q' ]; A4 ~ G& znginxd=/www/nginx/sbin/nginx2 r' x& ^9 \4 s3 t
nginx_config=/www/nginx/conf/nginx.conf
' ?& N- r K& z- a! D/ [nginx_pid=/www/nginx/logs/nginx.pid
1 B2 [1 N1 x7 v0 T" r2 \7 \RETVAL=0
7 h& p) c0 ^* @, ~prog="nginx"1 n" J9 l- f% s5 L
# Source function library.
8 V3 d5 L( d" M& N. W) N. `. /etc/rc.d/init.d/functions
G! V* j3 ] ^, F( | W# Source networking configuration.' q; q, S& e% b/ E$ @' U- M
. /etc/sysconfig/network
: ^5 O) r) e+ g1 Z# Check that networking is up.! t9 Q8 C+ Y: g2 n! w7 X* a3 h
[ ${NETWORKING} = "no" ] && exit 0& r$ A! n* _8 W
[ -x $nginxd ] || exit 06 {+ y+ Y+ ^8 {3 J, _
# Start nginx daemons functions.
3 \$ D, |2 N: i# X3 r4 x4 wstart() {( k& m4 Q1 `2 N% w) u
if [ -e $nginx_pid ];then
. C& [" I8 D$ c; `echo "nginx already running...."
; }* [' @& T2 aexit 1- ]' n" H. n( q/ |7 f
fi& Z! ~! w2 i4 x. @ @; A
echo -n $"Starting $prog: "9 M% Q; l0 N" L4 e* ^" p3 C: x
daemon $nginxd -c ${nginx_config}
6 ]* ?* r7 d; y) a* uRETVAL=$?1 X+ C3 _: l" O5 ?6 }
echo
5 a- O8 a* `! o# X[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
3 H4 O9 Q' _# n1 D* Preturn $RETVAL
) M. H2 \& {% q) Q" }# b2 a}
( w8 y+ P" |5 m( Q% c3 Z5 v# R* K* R# Stop nginx daemons functions./ g1 h8 G% }' P% I; e0 f
stop() {+ N; q! x8 V" z! Z' S3 h
echo -n $"Stopping $prog: ". V; S. }) n6 T! q, s
killproc $nginxd
% w. x& n& z+ XRETVAL=$?
' u2 X/ T1 o0 aecho3 Y7 W; K5 q* x/ y% d
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid$ F7 U: d, |% b: m
}6 p0 _% `2 C8 ]6 E- J
reload() {- ?4 e7 X( h4 a( e6 W
echo -n $"Reloading $prog: "! z. k4 c3 ^. X( `
#kill -HUP `cat ${nginx_pid}`$ @, ^+ q. x, r0 D4 s6 e
killproc $nginxd -HUP* I' ]0 P; h9 L( t( q/ S) x) l8 r( S
RETVAL=$?
! j8 j4 q, f, z3 q0 r; {echo" T0 [1 n6 d `7 }
}
* o- z# W7 m! I# See how we were called.
; y) {/ t1 \8 x, Fcase "$1" in
6 O: k/ T4 e% W+ E, Istart)
* d9 @0 j" O) O, C1 g* M/ Cstart$ d; L+ Q/ J- b$ t6 a& c% S! p
;;9 y9 ]$ z% O, A* j: R( H. Q: X
stop)) ^ ^ @ n5 {5 g) W
stop, a; E' E) o8 i* Y7 x6 M' r
;;0 Y H7 d- P& Z5 ], r2 g {6 h
reload)
" I$ Y! v# W$ R& U7 m! dreload! O1 l0 T/ c2 A! X
;;6 l7 m, l$ \: `& T4 L, I' y
restart)) R$ u" |9 y, k
stop
# @% ~0 f7 T! P1 l# w+ |1 {1 Nstart
/ E0 r. i* S5 y/ {* A; h;;: U% N1 {* I9 X1 e k
status); \4 ]: w% i, i7 A: c6 c/ g
status $prog
1 F, B4 ^1 ?- ~; YRETVAL=$?) Z% e; H, K0 ~( `- u+ G
;;
$ A- O/ M: O T' B8 t- a*)$ s1 C2 T* w+ W. G
echo $"Usage: $prog {start|stop|restart|reload|status|help}"4 V; E3 y# p) l
exit 1
: h/ D: h6 ]$ F3 x, c1 }esac. y+ H3 S. f& c. |( [
exit $RETVAL
3 z* E/ j2 X7 U& i9 h" g# n5 k$ P8 J! S1 Z2 r: k5 Y) o1 }
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 " p1 P3 `3 ]6 Q! p _
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
* P$ w- |0 ^# h F; f- q: _4 z. \1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 0 t1 X" Z( v! Q/ I7 S/ S+ |- D
location / {
$ C# j) W* Q |% ? root html;" }' B$ _- I( i& Z6 R, p9 w
index index.php index.html index.htm;* c: \6 ~0 b' ?: t+ R" C$ s0 L7 a
}
9 ]. }9 s& Y) M靽格嫣蛹嚗
2 j5 m1 t8 I; X% O! e8 T3 d
( A7 ~3 ?7 E* C% X3 |8 [) k location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
3 V6 }' o Z* blocation ~ \.php$ {
8 s2 N6 J }: D root html;
1 a. K- G; ]* u* R; E/ { fastcgi_pass 127.0.0.1:9000;7 O# Z# b: J K0 [7 C
fastcgi_index index.php;
) K5 ]- A1 W1 V# M" O fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;. Q$ W, M- g8 S7 B7 `
include fastcgi_params;
) b* H. N8 r! \. e: H5 a5 } }2 G& T8 M9 j$ Y" |
靽格嫣蛹嚗
) e* P( ^& z4 i8 Y! A9 f3 c( k# N& w) L5 j9 ~2 Y* G% u6 ?
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閫蝻拙僎餈唳桀嚗扯嚗 3 g' [4 c. O: D2 n$ 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$ B& m& n! X; f& v' ^% T9 w
% a. n; Z, J% W. @" M0 S8 C#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏
- g j8 m' [- g8 F7 t7 r$ O 扯 cat /etc/passwd 亦冽瑕銵7 S9 b7 E3 K' E9 N" J! z
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
: G& v. z2 Z5 p 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql6 K" _2 K! D) y0 `
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql/ `7 |. d# h9 p1 G
chkconfig mysql on3 O' ]& g0 W/ f+ ~& g
service mysql start --臬決ySQL, r& F8 |( E- @) }
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH" W* f* m( U$ [, f" P+ L
export PATH
- w1 b2 w# j5 q3 Q; |; `2 h 靽摮source /etc/profile 扯嚗 5 q- _' _4 V8 N& T( w! @$ G: z1 `
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');! i9 g8 y6 p9 W1 v& K
& h2 R/ @; A( m2 X1 @4 ^
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
0 D& k' x. J. Cmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
( k3 o) m2 e$ z- z#./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嚗
: |$ G0 _! t9 u8 \! L% u1 UPATH=/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 A: j. K3 @+ M5 p
* |7 p* h- \7 K, Y. f5 W# l% D1 K9 d# Krpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
& _) A m) P g3 `Create /etc/yum.repos.d/php-fpm.repo file and add:
8 q8 k, Y# W' F e. X- [nginx]
( Y5 I& ~. p8 ^ A - name=nginx repo9 I! w% m+ u4 [
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/3 A! o! t8 V2 V
- gpgcheck=02 h- S7 j5 o) W
- enabled=1
銴鋆賭誨蝣
* b% B% W! K' q1 T; z8 y9 iyum --enablerepo=remi,remi-test install php-fpm' u- t% p2 j1 F# G# W6 p
+ }+ g# p7 m5 T7 F% t9 W' b* D* g+ e- R( y$ G5 ^0 O- ?" i% ]
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
% u' M; M, S" q# ?5 b, `0 ^0 T0 h 嚗yum remove subversion //貉蝸雿祉svn
+ X) m" V9 k/ s& W # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn! O8 c2 U! k9 A2 I5 Y/ _
餈# 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]/ h+ r5 J6 Z, j5 R* C2 T8 b& a# F
# harry = harryssecret
) K' x! n$ P. ~, d; }, K# sally = sallyssecret0 z! a! F: a; k
wangning=wangning5 b3 b# I5 T( }
yanzi=yanzi
# |# {+ Y$ h; ]0 E- h } #vim authz //霈曄蔭 / s# _, w6 u" v& w
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none! ?6 m, h& }' t
auth-access = write! G; I. `- o& I# P# A* \
### The password-db option controls the location of the password
6 @+ r, x( y/ G7 c### database file. Unless you specify a path starting with a /," O$ D0 V# V9 c; u4 f
### the file's location is relative to the directory containing3 R- ~' M5 i9 E; E1 _
### this configuration file.
/ U x& X [: O" }% y### If SASL is enabled (see below), this file will NOT be used.
0 Q5 X% _' w' b j- U% l3 w6 T### Uncomment the line below to use the default password file.6 [( V% c/ c. X( D& [# u
password-db = passwd
! e- r1 a% _. {+ n$ o### The authz-db option controls the location of the authorization8 R, e! x- j& \. F q, n
### rules for path-based access control. Unless you specify a path2 A b7 S7 @' c' Z* z/ _
### starting with a /, the file's location is relative to the the& O6 o3 ?: Q% {1 V2 @9 A
### directory containing this file. If you don't specify an" V5 v; w' q& L: G) ? l
### authz-db, no path-based access control is done.0 N, Q# h t. \, }
### Uncomment the line below to use the default authorization file.
# e6 k: G, Z y1 r# x0 sauthz-db = authz
2 y; i3 |4 e1 U) Z- k### This option specifies the authentication realm of the repository.
, w+ Q9 A+ w0 a### If two repositories have the same authentication realm, they should/ c% z6 F6 m& Y, K$ S
### have the same password database, and vice versa. The default realm
- f, S! E* d. L9 u### is repository's uuid.3 E6 p2 N4 [( Q! i! p* ]) }+ k
realm = My First Repository
5 E8 a: T; i: v8 ` 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn* k; f, K7 s1 g
#killall svnserve //甇& G: b; L4 D5 I& |+ Q! `3 j
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx1 Q6 h2 r0 q1 F. W
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/web5 ?7 Y6 ~# K% }
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 ( B; `, R' @, i' L
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" :2 ]% A" |6 D; ~. f
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
' p! W/ s$ P) W( ?瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
9 X) b# Y' O* g1 g9 W0 M0 M. F: Y( zvi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿. i% Y9 t% \& y5 f' y2 y2 ?5 ]
|