: http://blog.csdn.net/yanzi1225627/article/details/49123659
$ E0 e8 q6 I9 e3 h
; I" `0 G3 p3 Y格嚗剖遣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, ]0 c9 b( o$ u+ g9 Q/ N4 W
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx: m7 c7 M& T b4 k8 i
嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
+ u y' N; `) D- z) H) S/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
3 s) E1 e4 P ~; \1 g& G
! l. i/ U; H9 S# @6 `: Y& Lchkconfig --add nginx
! ^8 _' O1 e- M. z; M
4 K* D4 E+ a7 tchkconfig nginx on% D) M! X+ v! q8 J
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
1 p: w }! }8 o# e+ ^1 Z; y# nginx Startup script for the Nginx HTTP Server
" M$ F5 ?+ E2 v6 `* g' {% ]# it is v.0.0.2 version.
6 l3 Q- V; c8 @: }% J# chkconfig: - 85 158 w3 b- ~/ g) E7 f$ W* F
# description: Nginx is a high-performance web and proxy server.
* Z( w; b( G5 n% J. Y# It has a lot of features, but it's not for everyone.1 t/ W3 @5 p! O9 N# }, H- N& v1 ^
# processname: nginx! n, }3 z* g; Y1 H
# pidfile: /var/run/nginx.pid K5 m! y. h" B) t- v& I
# config: /usr/local/nginx/conf/nginx.conf( k \, K9 m4 C" }% k
nginxd=/www/nginx/sbin/nginx8 F3 i# W. h; r& F1 X/ ]
nginx_config=/www/nginx/conf/nginx.conf, D* R& x4 I3 I2 C
nginx_pid=/www/nginx/logs/nginx.pid
2 K' F3 N) E% t8 q, Q0 c3 a5 ]RETVAL=0
' F+ D: B5 t& m: Z y6 {prog="nginx"
d- D8 X% x) ?' w# Source function library.
4 ]. M( Q9 [6 g1 P8 A. i4 h5 D. /etc/rc.d/init.d/functions, ^3 ~+ D( j8 r; g1 L! e% s5 [
# Source networking configuration.
4 v! M* j' S- B$ o- [7 ^' y. /etc/sysconfig/network
$ M6 m9 H$ E" W6 D7 ^# Check that networking is up.
8 |5 K- z* Y( g[ ${NETWORKING} = "no" ] && exit 0! J/ W9 x# E5 Q$ B
[ -x $nginxd ] || exit 0
/ M1 E, t$ u' M; P# Start nginx daemons functions.' G& i) V% p" d3 r6 D+ M5 v
start() {9 I4 y1 L: N/ H+ ?& o% V8 h- K! }
if [ -e $nginx_pid ];then
$ B. x$ j+ C2 H; K. \3 |% Vecho "nginx already running...."
* F4 l" Q0 z& G& b2 pexit 1& x, I- z0 s; B0 T7 T
fi, N6 `3 ^6 C& F% d0 Y/ m: J* d4 k Z
echo -n $"Starting $prog: "% ^2 c' A$ w' [9 Z
daemon $nginxd -c ${nginx_config}
! f( w: y! J$ I0 ~9 yRETVAL=$?
( R9 Y% ]8 M" A4 q5 O3 P$ Cecho
' v e9 m9 w' o2 e+ F* w4 w[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
3 N0 `# U7 j2 v# l3 n, I8 t' K: ^return $RETVAL
, ?% d. e* \# o% ~$ q" e3 w% | I}
- ?" W; W/ W- a1 G# Stop nginx daemons functions.4 d& @4 J3 M9 K2 z% D
stop() {
6 H( x' q4 o( B$ `( h/ L; qecho -n $"Stopping $prog: "
0 I. ?* b* F9 y2 e6 Kkillproc $nginxd5 R9 ~) h9 C4 [
RETVAL=$?
! [5 g0 y- B# [4 @- yecho4 g5 q4 l: g2 r& `1 V* x: n+ C
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid
& a7 R2 {: P) [, w6 A4 \* K- }}
- ]9 r- b. J' G2 [# Q3 k. x, W. Xreload() {
, I1 `* y9 _& g% W4 R! ?echo -n $"Reloading $prog: "0 E( c" G, [, ~; l+ \; ^0 T# W+ o- W9 x
#kill -HUP `cat ${nginx_pid}`
) k1 k+ {' ]" ^: {0 r6 G- \1 x9 Vkillproc $nginxd -HUP
& l4 |0 ^- T8 y0 ARETVAL=$?: V5 T5 _* `' I) ~$ N. h$ [9 ?9 F
echo
7 `$ e" [! P- s2 y4 H}
& T# B, x. J5 ?1 Q. X# See how we were called.. `. B; F9 M/ t: N7 I: h- T
case "$1" in
; n+ e2 |+ |* d0 z' [# |+ qstart)! h6 b; ]7 i! t# Q8 U+ N
start2 J" O, k+ F7 v% t5 H
;;0 T }4 w) }2 S0 \1 f s2 t
stop)0 Q+ c( l* {: ?! y* L: U. I& t
stop
; V2 Z; p" l7 N: C" g8 d4 d, S( _;;' C" N/ ~) n, ?, s$ X; U
reload). I/ X' G, t8 J( R, c
reload" Z1 y" w8 I L
;;. V- f9 E7 e. w( q
restart)+ u1 B* o& D8 g
stop
! |* q% u5 t& k+ Zstart
. e/ V; f, a7 [" h% ?;; X+ ^* U6 M% m* y- {0 A/ g
status)
* y8 A) V! B7 P6 c7 C2 }status $prog
6 W! L9 \0 ^6 v Z" p! W4 _" MRETVAL=$?
" W. k6 a M# M Q& w" H1 v9 H;;
. v% A$ ~$ m8 g- S/ n$ ^2 q4 x/ L' H*)
?7 A- n; k+ b& s4 qecho $"Usage: $prog {start|stop|restart|reload|status|help}"
" W2 `3 b. U" Yexit 1
, @' _. E2 F* jesac
+ D7 Z( h7 \- o+ i6 I7 mexit $RETVAL
6 N: v8 c2 d c5 V' G1 ~0 T( Q: f1 K: K7 K
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 # i5 Y, Z( ]0 y0 C( Q0 @1 K. e8 ]
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗5 ^+ b8 R5 Y7 Y) {' M" w8 w2 u+ s
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
1 l( s9 m+ ?& j2 s0 F location / {$ t9 C4 C- a3 t* Y6 P+ d
root html;% l7 v7 W* o! p3 P. W' h( I
index index.php index.html index.htm;% p! |8 J; ]' p1 G# Z, C
}
6 G- q& I0 A H5 \靽格嫣蛹嚗
+ F- s& Z7 g8 o3 _- N) r# F: m8 b$ P
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 7 b3 U `; b8 M j3 @" I
location ~ \.php$ {5 ]6 l/ q/ M+ H: T$ d3 m
root html;# `; `" K' {$ V4 t) L7 C- R4 l
fastcgi_pass 127.0.0.1:9000;
6 g; f, Q) m: W" Y* N) ^) Q* W fastcgi_index index.php;
$ G" C& \+ i& Y5 W7 D7 k3 R fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
9 ~* m5 y8 |7 F- Z+ U include fastcgi_params;5 ^* H, T7 W" C( L! N# E! E
}
/ G& P7 Z4 X% C: x靽格嫣蛹嚗9 K0 M4 u/ M) ?& r% j
3 R* a$ B1 E, u6 e" k5 f( |
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閫蝻拙僎餈唳桀嚗扯嚗 5 V4 T0 G, u9 ^2 K9 F" g
#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql
5 k' C; E3 {, }. e% Q8 ]6 ]. ^# |! S0 ]) y7 j
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏9 t) B' Q! L" a0 E! l; w S0 w
扯 cat /etc/passwd 亦冽瑕銵
, |% U/ s% ?8 u5 o0 U- Y5 kcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀3 L9 f3 S" q2 i1 k! ~$ G/ L- p
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql' H3 M; Q# Q/ i3 ^' D8 a8 |
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
6 ]# }' P* ~0 o# S$ Schkconfig mysql on
w. {4 i! b8 d4 t' [! f wservice mysql start --臬決ySQL
3 y' f. Z4 Y" w 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH) r$ V8 I5 z2 D; U. u
export PATH' U# V2 L5 [% a: y
靽摮source /etc/profile 扯嚗 3 ]& F1 Z& C/ s9 K
mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
, x3 f. A. F! b7 [4 V( r% G
: Q0 j" k' i# l, y3 Z+ { T7 W霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
0 ?, y$ U; O- D$ h1 z$ tmysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 # K, s3 n9 T2 {- U
#./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嚗 ( O5 a+ O* L' y
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
# Y1 H( r ^, }6 T' G7 x
, E. U7 s$ I# f5 s7 @rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm4 E5 V$ E$ ~) c) Z. [
Create /etc/yum.repos.d/php-fpm.repo file and add:+ {6 @+ z& t5 [( c. I. l
- [nginx]7 i D+ R9 U5 N( F4 ]* L# Y
- name=nginx repo$ r, C3 U# T( t
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
3 S+ s- {4 a7 B - gpgcheck=0' D2 L! Y' P' j% p1 l
- enabled=1
銴鋆賭誨蝣 ( T* \" t! y) f/ b; A2 x
yum --enablerepo=remi,remi-test install php-fpm
* c4 Y7 S1 {" V( z+ \8 J# ~1 G- l# x& E4 m4 ~7 R
* j4 e: {; ?% Y6 P9 K- ~4 G5 k鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn8 i4 N: f. n- c' |' }1 C/ |( _
嚗yum remove subversion //貉蝸雿祉svn0 H D' \8 Q" M G4 w
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn
& k+ X4 k+ j1 V3 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]
) {6 H& I1 t. @) R( o4 f7 }# harry = harryssecret' R6 ~. x5 ?1 I4 c/ W3 t
# sally = sallyssecret' C( Q0 N- ]3 x8 S& {! k J
wangning=wangning' B" N& N. O0 v1 M
yanzi=yanzi; I8 h' S+ H$ \
#vim authz //霈曄蔭 - n' w9 b8 }* m3 L4 e. G
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none3 s6 f/ {, C& U$ {) E6 M
auth-access = write$ ?: B5 { \4 [4 Q/ n
### The password-db option controls the location of the password
5 @+ ^0 Q- U6 ?& Q! Y- x### database file. Unless you specify a path starting with a /,. A' O: N7 _! ]9 ]$ x
### the file's location is relative to the directory containing
9 ?# P# {4 J8 W+ [; A### this configuration file.7 n3 Z- B1 ], ~- W8 h9 B) K! e
### If SASL is enabled (see below), this file will NOT be used.
6 t& V2 P0 s/ y% ~### Uncomment the line below to use the default password file.- |& u9 ~4 y* L% V, ?" L# Y b5 k' q
password-db = passwd
3 d5 `" N3 J2 t! P### The authz-db option controls the location of the authorization9 b- a+ a' z2 D7 R# ?5 ~
### rules for path-based access control. Unless you specify a path
5 A' h- W- g1 J+ T! c L### starting with a /, the file's location is relative to the the
0 e% j8 a0 J" Q; O### directory containing this file. If you don't specify an' A) d# R9 H i: I# V9 J
### authz-db, no path-based access control is done.6 _3 a3 `. Q& D
### Uncomment the line below to use the default authorization file." t' I, y8 w) {6 i9 u; b5 o
authz-db = authz
5 b9 [3 z7 r0 R3 E+ ?7 P% Q### This option specifies the authentication realm of the repository.
2 e& P1 }& G3 }: k' d# i### If two repositories have the same authentication realm, they should2 e- Y! }) {4 j4 \9 E5 A
### have the same password database, and vice versa. The default realm
N; U4 l/ ^+ a$ L### is repository's uuid.& r3 ]* i0 J1 i, S. s4 l/ ~! ?
realm = My First Repository
* W# u% @5 w- A% o: _ 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn
3 G2 p& V+ n e+ c2 P g #killall svnserve //甇
1 @) ^: U6 N( Q3 _ 敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
+ ~# l: r F$ e# F" B 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
! _& {1 |" `1 G8 V b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 ) i' O, y# a* y- q
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" :: r/ K1 Q% {/ c& B* u9 ^ f8 z+ _
#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
% R$ y, P! t9 w) r5 T2 B0 p' t瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
3 u/ N# J* ~% V; }9 n3 xvi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿 ^6 ^' f* `, W
|