: http://blog.csdn.net/yanzi1225627/article/details/491236596 i1 n: z0 J, }; O3 U
5 B0 L+ B4 {) ]/ b8 \! g& R2 Z
格嚗剖遣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 cmake7 S; v9 h5 X" B4 ]1 f9 X9 `
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
9 b7 W. }7 X/ G 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
" K1 m4 }) u" s* L" l l6 M. B; \- G/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx
. t- K( T; Z5 I1 V2 }9 i4 `& W8 v& z
chkconfig --add nginx* U: N4 ^1 M7 W& Q& h; `& ^
2 Y# N# N* w7 w: n1 N m" \chkconfig nginx on& F% ^' I K1 Y9 C
嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash
+ h, j2 Z, \6 n. n. T/ W# nginx Startup script for the Nginx HTTP Server5 u6 g& }1 w! {7 Z- P w' S$ d
# it is v.0.0.2 version.
- p* S" ]$ P d9 w2 U$ t1 K6 g: D# chkconfig: - 85 15# V; h3 Q- P* Q! _: z8 t6 [+ ~
# description: Nginx is a high-performance web and proxy server.( P" `1 \) v; f( s, T1 ?1 D
# It has a lot of features, but it's not for everyone.
- A! J) O- Q8 [3 a- k: h# processname: nginx
$ k6 f5 I; C' F- v1 K# pidfile: /var/run/nginx.pid
' K. t/ U4 W5 ~4 R. ^# config: /usr/local/nginx/conf/nginx.conf7 q3 `! k+ a6 J. t
nginxd=/www/nginx/sbin/nginx
% c0 x" {) a' Dnginx_config=/www/nginx/conf/nginx.conf
; \8 v- Z" h B, D1 Enginx_pid=/www/nginx/logs/nginx.pid6 o/ V/ I8 L8 d$ M
RETVAL=0% z$ {4 _2 u6 G- o( s
prog="nginx"" j. i5 `% q# d
# Source function library.
6 A; ~" x. m' W) J b. /etc/rc.d/init.d/functions
7 _" S N% t2 Z7 p# _# Source networking configuration.) l6 u! T* P U, f: ?1 u2 b# [
. /etc/sysconfig/network
+ U1 k( E: Q% G0 M( j. W( c3 B# Check that networking is up.$ k$ x: O4 F, D9 N- F
[ ${NETWORKING} = "no" ] && exit 0
/ B* x) f V5 w( `/ g9 W# l[ -x $nginxd ] || exit 0* W, v7 ` t; ]
# Start nginx daemons functions.4 Q. s$ P+ s P) m( F7 y$ t
start() {
8 u! d' C5 T' ^- b' aif [ -e $nginx_pid ];then
h/ }! S+ y! {6 uecho "nginx already running...."+ s5 C5 e) e* _; v$ @
exit 1 R9 U2 L+ }& v
fi. e/ M% c. B0 P* ?& i
echo -n $"Starting $prog: "* F) z) G1 J7 c
daemon $nginxd -c ${nginx_config}/ a# L( z7 [/ s2 u6 {1 d8 b( R
RETVAL=$?
/ x: m% }- e# k; cecho
$ }2 k: N# B2 t v) Q; e[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx$ h. B# {, n2 a0 E$ |
return $RETVAL
G2 K, g% k" C" N( k}5 t: d8 Q' h! H
# Stop nginx daemons functions.
' i* q9 T/ w. J& l2 F* Mstop() {
4 U* w! k, i8 f# S# F+ aecho -n $"Stopping $prog: "
' |0 s1 Y, i: e4 K) @: u5 o5 [killproc $nginxd
9 V1 G# N7 k5 t( ~' v# @: {! G2 rRETVAL=$?, b+ I S! i. u) e: V
echo
/ R7 l0 ^$ ^4 G% x! `2 D. D3 C[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid2 E$ C/ k8 y; i5 P* `( n2 u Z5 Y8 k
}# q0 k) [5 G2 Q( T6 R+ }/ z
reload() {1 R- D0 ]0 u7 p/ T% x
echo -n $"Reloading $prog: "
8 M* L0 i3 t" T" a) l% w+ b7 a#kill -HUP `cat ${nginx_pid}`: g+ j$ g4 p% J: ?2 [
killproc $nginxd -HUP
6 m6 w) f. E$ X, H2 a v. BRETVAL=$?- G* ~* K/ ]6 p7 b% h3 }# }
echo% G- V8 t0 F5 a) m5 q% i# d
}
2 A+ g$ z8 G8 _# See how we were called.
7 v* l) I8 i# i# [2 ucase "$1" in
( ~7 X& J0 k% u$ n" Jstart) e+ m# q- h* R+ `6 f5 ]/ T( m
start j) W, s0 D* }. @( c
;;
) W+ Y% E: W& e8 Tstop)2 V9 j8 t+ L- S# q6 j$ H; o
stop( E, d3 F/ \+ @ y) o9 }7 s
;;
9 d) f2 e2 P& ]! ]0 H3 o# ]reload)
2 G0 ^& j) T+ R/ k0 f7 ~reload9 Z7 b, t3 ^1 _$ ]
;;
% V6 A+ Y- j: A3 D6 s0 Orestart)
3 Q9 v9 o/ r4 G* _; f% t& Estop
, w8 P' L7 Q9 k+ {start
, ^' y* Q: r& Y' g+ ^0 Q2 a# c+ V;;
+ Z- t% T$ J1 A6 jstatus)8 n G( j. }4 O6 Y& o5 U
status $prog
/ d1 T, \3 I1 p$ NRETVAL=$?
" q5 d6 ^2 Y8 t4 q+ g- A% f8 P# d; S;;$ F8 \" H- w/ S+ j- f/ I: E
*)0 ~4 a# I8 {" s- M9 T; _
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
8 G# ?9 C b/ K4 pexit 1& O0 u1 H! P: E& f# }
esac
7 A1 Q# H) n$ ~! Q, E0 b z" wexit $RETVAL9 J: Y; G% _8 ^5 a2 }% ?1 Z- t9 j
4 ]/ B1 N$ k1 U# a
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬 - C+ |! ], Y0 A
chmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗
& M) I; a+ [8 H Y g1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
3 \& m3 |! f; h+ P9 R4 g location / {- Q- ]8 @5 ~$ B- K
root html;
' Q7 T, t2 [, }$ N* r- [ index index.php index.html index.htm;
6 y% a- [1 e P0 ~$ K8 s }* }" u8 Y- }7 M5 }5 g7 o3 S
靽格嫣蛹嚗
% M2 f" e8 B/ I& Z& a' F% D6 U2 \* E, D) \6 V! i
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠
# l3 o$ B7 i" X' J* [location ~ \.php$ {& H2 ^# l; L+ ?) H* ]
root html;* r0 K1 B- ?% L2 \/ B$ F5 p
fastcgi_pass 127.0.0.1:9000;
* x, a) l2 H6 z; i" Q( } fastcgi_index index.php;
1 f' L0 O/ X7 B" a, p4 H' ? fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
8 x6 |' B, O6 B0 u2 Z include fastcgi_params;
, a# N1 _- F/ N$ @5 | }3 j: H1 J+ X2 O5 G, \7 F3 s C
靽格嫣蛹嚗( O! k- \& U) D) j
/ p+ G5 y/ ~, o. _2 V, O% s* g' J 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 H* ?' Q* F$ z# X5 o, Q# 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& {- _6 s# g, x+ m0 Z9 H
/ n* {2 J, E6 W/ A# ]6 @( T) G#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏8 I3 C& T" P! `& a! p4 R+ s& |! U
扯 cat /etc/passwd 亦冽瑕銵
% M8 o6 s' i" `& `; R" zcat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀
' N( o5 W& T1 E9 p, ~ 3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql6 h! h: h5 n' I
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql" W/ S: H6 ^) m+ s0 ~3 F( c
chkconfig mysql on, R* ]; O' k& t, Q5 H* X
service mysql start --臬決ySQL
* O% [3 h7 a9 L 5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
- W3 M- s m/ aexport PATH
' `( L+ Y, Q% Y 靽摮source /etc/profile 扯嚗
. x# u6 i e$ P' C& ^3 F" _mysql -uroot mysql> SET PASSWORD = PASSWORD('root');
! J6 i& V" D3 q# O$ l& r
" b- u/ X" V! Z* @: J- R4 A霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗 + G1 ]* v2 @4 L3 v1 }/ d# J* @; c n
mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗 2 h: h6 J, W0 r4 ^2 R) ?; p3 I5 n" e
#./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嚗 4 c/ w ~% ?' X6 d8 S# r1 }% g, j
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
* V8 ?" [- N* J) G0 |: r7 o) z) G ]. d: w' m, E
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
# }& W8 j0 k& ECreate /etc/yum.repos.d/php-fpm.repo file and add:
2 Q5 x0 a, }% ?8 D# B( S S- [nginx]2 n# Z$ Y7 m) w
- name=nginx repo
# ^' n4 a8 M# r$ A* j - baseurl=http://nginx.org/packages/centos/$releasever/$basearch/' u4 x/ f" W. @
- gpgcheck=0: m6 M" ~1 n2 g6 J
- enabled=1
銴鋆賭誨蝣 " m J2 X7 A2 |/ M
yum --enablerepo=remi,remi-test install php-fpm
3 T. |& P/ h7 Z3 Z
( J: ^% O, a% e: Z7 o: @* D4 q6 x/ y5 F+ a# p9 C9 ?
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn5 P+ Y- }* Z+ E8 j' u- D# G
嚗yum remove subversion //貉蝸雿祉svn& _7 V+ h# P" L, m* a
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn( N$ h0 r9 }# r- ]& p
餈# 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]
& ]' K; L; M* g% e# c) G9 [! g# harry = harryssecret
& ]6 X# K7 ?- M' P" V+ o# B# sally = sallyssecret
; Y4 e. \1 d2 q/ Ywangning=wangning
) U( y6 T, r* P) A, ^; wyanzi=yanzi1 ?1 U5 W( i& R8 D' N5 R
#vim authz //霈曄蔭 n: f: ~$ ?2 q/ M( s9 K1 }* ^, {# o
[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none& ~! v3 P, W( y0 c4 Y) b( U5 j
auth-access = write
1 [% f! D8 Y3 c1 c: i x- y. a5 p### The password-db option controls the location of the password
. R2 q6 ?8 Z) j/ Y' k### database file. Unless you specify a path starting with a /,
. P8 ^( w; {7 `3 \4 x: j) M0 }### the file's location is relative to the directory containing
5 y- i3 {* ?& v a* ?### this configuration file.
1 Q; p% K4 _# n' P, _### If SASL is enabled (see below), this file will NOT be used.
0 M0 }1 @' w1 b8 e### Uncomment the line below to use the default password file.
1 S7 e/ l v2 _( c: mpassword-db = passwd
9 |2 G' w' O; b### The authz-db option controls the location of the authorization
1 F6 ^/ W! q- w' ~' N### rules for path-based access control. Unless you specify a path
- o4 h2 }* _4 _. \: R6 C% e: B4 b* u### starting with a /, the file's location is relative to the the
+ s9 ]4 T( I9 \& ~### directory containing this file. If you don't specify an
! K9 P" g7 t% {" B3 }7 ^# a### authz-db, no path-based access control is done.
. A: b9 d/ x) @- t### Uncomment the line below to use the default authorization file.& K, u0 D; v2 _0 h) `: E
authz-db = authz
+ P& u$ G, E. n S### This option specifies the authentication realm of the repository.
6 Q& G- U( [ \5 V% J### If two repositories have the same authentication realm, they should) T0 O) w5 `2 W% j4 \# N0 H& H$ u
### have the same password database, and vice versa. The default realm; x9 _9 t7 i' c7 H3 e) a- g3 J
### is repository's uuid.- U$ V3 g% u) |" T; g4 r
realm = My First Repository
* T, s6 _$ g( A 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn* A8 | g1 f! [" `3 b
#killall svnserve //甇9 z) n3 Q6 L! }
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx: o. R5 ]5 a; E- c, U. x
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
& j0 N) ]! F# z b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐 # y. `; m' J8 M- s
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" :
9 J/ }1 }& B' ~( e' w- |#system-config-securitylevel 豢DISABLE敺OK嚗敹璈
* c* T! g( l$ c" c9 ~6 ^2 \$ @瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急
vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled 1 u5 A, a) A* e3 l% Z
vi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿% @" \: z; G5 T: A" R
|