: http://blog.csdn.net/yanzi1225627/article/details/49123659+ D7 \) ~+ Y/ N" C ?" S5 x! m
" o- S7 V5 Z1 Q, h, x4 z0 Z3 i2 S) 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
4 c! Q5 D. J4 k4 H" E3 n 湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx4 w5 S- {: ~+ c! j
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www+ [' U! P) m- v4 w; c* [
/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
: }; v0 h" F+ y6 Z! O5 R8 n# B- R6 Z
: S* E2 v- o' r5 i) |3 uchkconfig --add nginx e. H8 w! X/ z3 e: Q. P6 h0 O9 E- m
9 N3 c+ E! N. ^, Y: Nchkconfig nginx on
+ s) D( U. _3 R, R& r' C 嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash( p9 R) Z l, W H9 k5 S6 s4 A' `1 y
# nginx Startup script for the Nginx HTTP Server% Q& E( \2 l/ k2 d! E$ l
# it is v.0.0.2 version.* d8 s3 @# @5 ] A. H
# chkconfig: - 85 15
( v2 e5 q% B, O" y7 d# description: Nginx is a high-performance web and proxy server.. p0 R( [6 W$ u- G3 i8 L5 u2 H4 N9 [& a
# It has a lot of features, but it's not for everyone.9 T2 t$ Y* x3 N7 K( S: ~$ D" ?
# processname: nginx
6 C Q7 B L: i) R% J# pidfile: /var/run/nginx.pid
+ ]( F$ c3 l2 M' d" ` A) K# config: /usr/local/nginx/conf/nginx.conf
4 Q9 S+ K3 Y/ ?; `2 O4 \$ snginxd=/www/nginx/sbin/nginx: u# [ O8 V: `; ?; _. L
nginx_config=/www/nginx/conf/nginx.conf
- _1 [8 s4 ^/ nnginx_pid=/www/nginx/logs/nginx.pid
( D4 ~( Y$ B8 `4 \RETVAL=0
* y8 s' Z' c) o+ pprog="nginx"/ d/ T8 I, E5 W$ u$ ^
# Source function library.- W( X8 @0 h: w* Q1 N j
. /etc/rc.d/init.d/functions
/ r+ M) d6 W5 ^. w, p" n2 U: G# Source networking configuration.
! ~# W8 f3 R- j) r' `% ?. /etc/sysconfig/network
* u9 H H+ k- c. {* H; M# Check that networking is up.
# t/ E4 U: r W# \ q: _- B4 ?4 `. n6 V[ ${NETWORKING} = "no" ] && exit 0" k D% q: ]) J \
[ -x $nginxd ] || exit 0
/ d% u$ e! h% v# Start nginx daemons functions.
& e3 Z* V% ?/ a" zstart() {1 W8 ]3 j9 f* t; r! |
if [ -e $nginx_pid ];then
3 Y( [1 L! H( B4 E* fecho "nginx already running...."
- W6 o$ b; C: b1 N/ I2 b, X) M8 ?exit 1
; x3 W ^5 g, l8 P Afi K+ O, u) n+ ?+ Y' L
echo -n $"Starting $prog: "6 d3 I' y$ d$ o& X7 d
daemon $nginxd -c ${nginx_config}7 T: B! o7 l. F' h8 ]; ^' v, M
RETVAL=$?
0 B* q! [5 ^* B4 {echo* @7 r* p8 V$ f7 Z
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
6 e3 z1 r# y9 @5 t1 ?8 b- _return $RETVAL
& O8 D) p4 B/ x* {# t}
' s( T: h2 h: \# I" a% F% V- V# Stop nginx daemons functions., H/ K; b5 F6 t x0 g% U* |9 B, X
stop() {
n1 N) ^6 H* secho -n $"Stopping $prog: "
- q j# s& S5 v* I& C# L0 xkillproc $nginxd% ^2 G" A- `! b" B; x* T, o
RETVAL=$?
% N2 U4 x) ]# ^3 Wecho
' V8 P% G2 K+ c9 u' [[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
$ }: Q! {( f- q* U+ v# ^& _. S}" K$ Y9 \) E0 z# E' j( E6 S
reload() {
* k& q% D. E# J" |% ]* Yecho -n $"Reloading $prog: "5 v7 w! a: O/ v0 _# K
#kill -HUP `cat ${nginx_pid}`" ?2 b3 `0 p X
killproc $nginxd -HUP
! d+ t; y/ q( m5 h& [RETVAL=$?- G9 N2 } [0 {. U1 M
echo; S' h/ r2 l8 `
}7 W7 t- E# M6 {3 N/ _( F
# See how we were called.
9 z2 S7 Y2 n* vcase "$1" in
- g- ^. J7 F- m+ M/ s4 w+ istart)
* X" I- ^" l. M5 h+ qstart
- D. t" W3 _5 Y: p% q;;$ y. x# z7 f5 |+ [
stop)
/ }+ _, N ^1 I! ^/ |5 ~2 Y% xstop6 }# y7 t; L* W) Q
;;' B6 g; Z5 t! Z9 c1 z& V* S
reload)3 Z( a3 v' z8 b' g
reload
% l7 E# U8 r6 g;;" Q I! o6 e* m, u0 o( H. m
restart)+ G F2 E7 D, c- o, S7 E
stop
1 v/ y( l8 O8 _6 qstart( o, a7 S9 Z# X4 m: b$ R
;;- k: u4 F8 N3 N' f) a$ c
status)- }( D* u8 n% w& X) l
status $prog
]# e/ Q- Y5 @6 |& A( F0 |3 eRETVAL=$?5 g& X, p7 Z& [3 _
;; R! L4 v q* u- @' \( b3 ^
*)* n" W& M3 O% ^
echo $"Usage: $prog {start|stop|restart|reload|status|help}"% Z& Y/ p6 `1 z0 |4 ^4 c
exit 1
* c' P+ f# F: g; W) [2 Gesac" z$ w" j& b; N" n
exit $RETVAL* H D) u/ q/ S+ X
2 P. }5 A( I, W' r& ]
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
- [5 U* H/ Q# @8 ychmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
, [& _) E! M2 J% `1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠 + |3 t) o4 X1 O8 m& H1 w
location / {
5 Y4 u# n6 \- y; S9 \ root html;6 p8 ?" s3 @- @$ {7 w
index index.php index.html index.htm;! e! Y- r, r+ `' M1 c' Y' ~
}
5 {, E: d4 X" Q1 W4 A* t靽格嫣蛹嚗1 o( }7 u. S5 Z. o$ |: F
5 l; B( Y E6 o+ b# I
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
0 m/ \% } r3 i4 F. Y7 P# ^" B' s; Llocation ~ \.php$ {
e% J' m: C( n! B root html;) D" i( Z: q6 \
fastcgi_pass 127.0.0.1:9000;4 _3 x Y/ `. i& M3 l2 S3 b
fastcgi_index index.php;/ \4 s* `) l- l% ^! V
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
$ ^" F& J6 o$ D7 k include fastcgi_params;) d5 x; E2 u7 N
}
& ?* L# o* E$ _' _7 w靽格嫣蛹嚗5 x3 ` v# E8 A4 L0 H4 e0 R
0 c, c8 ]/ _% H 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閫蝻拙僎餈唳桀嚗扯嚗 + h( {& J1 d0 q' d2 [0 F1 s
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql, r1 a/ w' \( r7 R! g5 e+ \2 M
' T" L, [0 d! r! r
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏
. f5 E; F7 D, U3 e6 o2 I- r) a6 @ 扯 cat /etc/passwd 亦冽瑕銵. L4 Y; N9 y8 K- r8 @
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀: \8 M" R, u( W4 _+ C
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql$ k6 B) v' [1 ^6 T' x/ w* f$ w
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
+ d* C$ {0 B" _3 Ychkconfig mysql on
2 x4 q( B# {, u8 k' Kservice mysql start --臬決ySQL
3 p/ ~5 M9 n9 d! `4 c 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH+ Y7 N" F& q; @% ^
export PATH2 k U' X! L/ o8 p9 c; H' C! f
靽摮source /etc/profile 扯嚗 : V7 x" |( m! A, |- k* s! T8 X
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
8 i1 `* \ {* x' X3 y
! v# r; s' s% O: h Z7 ~" _霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
' O) W" `% u# b& c, ^6 Jmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 / [" Y8 S7 p; U* S0 \3 Q5 M. [
#./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嚗
8 Z3 `$ L1 @! W5 u& I: W9 R, GPATH=/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
7 a$ U4 d3 M3 b% u: K: [
; p% `4 \; Y% w+ Erpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
& S! k* K. K$ F3 x! w% {Create /etc/yum.repos.d/php-fpm.repo file and add:$ y) F w1 f/ F- i {) ]7 h
- [nginx]
9 G* g: ~2 |; [ - name=nginx repo
9 E8 x) D; j$ ^. t0 y - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/5 s! Y) h5 j7 u
- gpgcheck=0
6 k9 L$ i$ n; u - enabled=1
銴鋆賭誨蝣
: V; y: C7 B; C9 dyum --enablerepo=remi,remi-test install php-fpm
( s' s0 I' U1 C9 q6 l K; C
; p( I( S* u' C8 V' t2 o% Q& W. v/ k/ u. D3 j: |) |
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
5 Y# P3 K4 Z) o% }" q3 n 嚗yum remove subversion //貉蝸雿祉svn
4 m; m k! J: }& ], P # yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn% ~, |1 K6 W* O1 \
餈# 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]# H8 G' p" c. [% `$ Q
# harry = harryssecret
3 F, {- ]0 {% l2 f1 o# sally = sallyssecret
+ z+ L: x& j$ b4 k" L8 j. ?2 Lwangning=wangning$ B. P* b b/ G; C- h0 \: O
yanzi=yanzi
* @; ]0 B9 G9 Z2 w: f #vim authz //霈曄蔭 * o4 N: @6 w, A% {% ]" U" g- q
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
, u: I- t8 i( C( c/ d' e% Hauth-access = write
& P1 }* K) ]2 Q, `+ E### The password-db option controls the location of the password
9 Q) t" L' [; w# k### database file. Unless you specify a path starting with a /,
5 M; x$ ?6 [4 R% ?+ A, L### the file's location is relative to the directory containing
2 Q% A! ^# ?* A3 x8 l4 m### this configuration file.
, g5 I1 h1 p% K, X/ `, b( E### If SASL is enabled (see below), this file will NOT be used.
7 C$ Y" S! u3 ~/ N1 E### Uncomment the line below to use the default password file.
3 g: H3 t4 p# bpassword-db = passwd- m- u# ?. k4 y9 d1 R U: ?. P
### The authz-db option controls the location of the authorization
' V3 w3 K# S! s# h$ I. O### rules for path-based access control. Unless you specify a path$ J7 b- Z2 h2 F1 r" h, x
### starting with a /, the file's location is relative to the the
3 W! |% i0 G) V4 K* e### directory containing this file. If you don't specify an/ V1 L9 I: k7 d$ E! R6 `2 {- b
### authz-db, no path-based access control is done.# g" E6 J8 {5 K0 E! w. {
### Uncomment the line below to use the default authorization file.
* U3 T# s5 r, y% c0 b4 Y3 mauthz-db = authz
+ K+ J9 v8 C5 w& I6 z### This option specifies the authentication realm of the repository.* u) H3 v# v1 ~
### If two repositories have the same authentication realm, they should
( c, ^2 \' {( _7 h. N### have the same password database, and vice versa. The default realm; `$ D. e8 w, w8 |2 D0 `
### is repository's uuid.7 W5 E% r' u- s* E1 |
realm = My First Repository4 J& [' y. w% |; \% A
瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn( I, u& w, X( {5 k5 U
#killall svnserve //甇$ \. ^$ ]4 l7 }4 i1 W/ X
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx* S' L) k$ {' U5 L3 P7 z* Q
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
* Q1 V0 G3 s' d& @# f1 r b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
$ h0 J8 C. K/ T: K5 Z Wexport 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" :' n0 k% P- @6 u4 i7 j5 p% R: K
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 7 @" b5 s/ m) [; J
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled 4 c$ r3 E& Z, w# S' ^2 @( N2 S
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿 U( Y$ Z% I4 h- \! `4 b1 j4 t( J
|