: http://blog.csdn.net/yanzi1225627/article/details/49123659
+ L0 N8 q; k) L* y, y7 L7 K& w F( Q% M
格嚗剖遣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) z1 J. ?$ ^- B
湔亙敺摰鋆靘韏摰鋆摰 嗅銝頧緯ginx 嚗mysql嚗 php皞隞嚗 舐 google search engine 撠啁 撠餈銝隞緣ar.gz隞園餈scp賭誘撘唳∪其/www/software桀銝 鈭嚗摰鋆nginx閫蝻拇隞塚嗅餈迸ginx-1.8.0嚗颲亙賭誘嚗 ./configure --user=www --group=www --prefix=/www/nginx
0 O# `' {! O) ^7 | 嗅make嚗make install撠勗鋆摰瘥鈭 摰鋆摰蝚砌隞嗡嚗撱滴ww冽瑕蝏嚗血隡http://blog.itblood.com/nginx-emerg-getpwnam-www-failed.html 霂胯 扯嚗 /usr/sbin/groupadd -f www
& r3 y% f2 N/ o2 P: h. K/usr/sbin/useradd M -s /sbin/nologin -g www www //-M 銝撱箇雿輻刻桅 nginx賭誘/www/nginx/sbin/銝嚗瑁/etc/init.d/銝隞踝乩亥挽蝵桀箏臬具 chmod 755 /etc/init.d/nginx4 u8 f9 a' ^# I7 J) u' I1 X
" J9 \) A) t0 T* @chkconfig --add nginx
& ]- q4 P. Q' O! o) S; @
$ f2 C" Q. O' x {chkconfig nginx on
: F) T0 a( x4 h1 A 嗅 cd /etc/rc.d/init.d/ 桀銝啣遣nginx嚗摰孵銝嚗 #!/bin/bash9 v! Z. T$ T- X/ l
# nginx Startup script for the Nginx HTTP Server) v0 D1 o+ T' I; Y7 Q' q- G
# it is v.0.0.2 version.
2 D8 Q. L% Y- k0 Q# chkconfig: - 85 153 d0 e3 y. r7 a, p% A; k3 s# @
# description: Nginx is a high-performance web and proxy server.
- L7 K7 L2 D: ` B( M: A# It has a lot of features, but it's not for everyone.: `) u; C1 }4 L; ] t/ k1 ]. ]# b: w
# processname: nginx
+ v! T Y8 {3 z" w7 Z8 B+ i0 y! n# O# pidfile: /var/run/nginx.pid6 o6 A' s) b7 {' S7 q: l
# config: /usr/local/nginx/conf/nginx.conf8 m; @; k5 R9 `: @$ v% R
nginxd=/www/nginx/sbin/nginx
1 t+ T$ Q1 x+ j6 T: ?nginx_config=/www/nginx/conf/nginx.conf
4 V* h/ F. q. ~3 c% Pnginx_pid=/www/nginx/logs/nginx.pid
B; {0 P, p0 dRETVAL=0
# X* |5 i1 D2 w! d0 G; ?prog="nginx"* F. Z# k: R: K# m
# Source function library.+ I; _% F6 F; M N" d. h+ a3 V% B
. /etc/rc.d/init.d/functions
! t- w+ Y% l0 A. O. `! p# Source networking configuration.
8 v) \' C6 j% j1 h1 f% W. /etc/sysconfig/network5 n( i1 I7 ~4 G" I
# Check that networking is up., x. E: ?) G$ i
[ ${NETWORKING} = "no" ] && exit 0
- e- u7 \: ?' i, V2 Y7 r' i8 V[ -x $nginxd ] || exit 0
: P! s! f0 M4 A& L8 q: F# Start nginx daemons functions." w% J" E0 L- f8 e
start() {5 g8 u5 `9 D( m
if [ -e $nginx_pid ];then
! J0 x6 ~+ M3 m/ ~& A$ x0 g/ K; ^echo "nginx already running...."' }4 p2 R/ w9 r" Q4 v
exit 1
8 F# W% G4 q3 L* c wfi* p' G6 {! L) [7 F6 _1 Y U: M# F
echo -n $"Starting $prog: "& \% o# ~: m |# J! ]8 Q
daemon $nginxd -c ${nginx_config}
1 l! ?! u0 y6 n: S( mRETVAL=$?7 n/ s5 Q" F3 [( B. n. U7 y" s8 x
echo- `( j" m( q) z) v- U3 J6 s
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
/ [9 P# @ X' c2 p* zreturn $RETVAL4 ]9 h% s1 D6 _2 l2 l3 b9 p# Z
}" \0 I! \ n4 D
# Stop nginx daemons functions.
) x' J" l) J5 ]) Tstop() {
' L( d, P7 x; }( g% {, vecho -n $"Stopping $prog: ", h/ u4 J. A+ O/ t% d* J: ^7 U: m
killproc $nginxd( W2 v( u2 t8 }5 g
RETVAL=$?6 K0 r/ i8 u$ o) T0 T6 z1 s& y" O
echo# F+ y; O- U5 v( j& x. ~; p; R
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /www/nginx/logs/nginx.pid; J) w. ] X {6 y
}, Z1 l, {( ]9 y& _5 T
reload() {
$ K, y- U4 b' q. T; f. ]) hecho -n $"Reloading $prog: "
8 N P' [) L5 d% j& W3 J#kill -HUP `cat ${nginx_pid}`+ @) {0 d" b8 T8 I
killproc $nginxd -HUP
$ z# k8 a$ m) n* ~9 f1 n2 dRETVAL=$?
4 |& {/ I/ U: b, ]% v! i: {echo
9 Q: P$ b0 ?! E: m0 R}
7 H/ |5 g# _0 t. d4 L# y" f# See how we were called.
5 i6 f6 i- { m% \case "$1" in
7 I/ N+ h/ K$ astart); U r5 \& D$ x6 [! W
start
+ k/ Y" V6 H' S;;
' k0 {8 w2 w; g2 Y n' D( Hstop)" x; ]9 R. b+ t X9 g" Y. }( B
stop
7 G7 o8 ]: k" ^% x" T8 n;;
2 \7 B7 r+ M0 X- areload)
& E# ~' ?% m& {5 c( m' Treload
5 Q( a' |9 l; d& j4 {# X! _& W;;
Y9 c& a- T9 W6 B1 x% s- B3 T; m2 ?restart)
3 i# x& L/ q, C+ C8 c4 Hstop. \1 `! }1 t, P9 \# ^! m8 o, r1 l6 a3 r
start
2 @) D* C% y" O- t! x! M* S9 Q;;$ H0 b' _5 x3 J% k! f, q U( g+ ]
status)
) J+ ~8 J9 a& v, F1 y6 j8 Y! J5 lstatus $prog
: z" R1 L- F* d) m6 B3 jRETVAL=$?' V7 G6 x' \% n2 B
;;: c# b4 o `& w# n, ?! `
*)
. {5 L, X. t4 ?8 [. ~3 t3 Y# jecho $"Usage: $prog {start|stop|restart|reload|status|help}"
# ?! f& d" X; a: ]% B! S9 ]* Qexit 1
4 _; @1 j( Z8 K4 K7 {3 \esac
1 z) }2 J( K* u+ [exit $RETVAL
7 y% J2 B3 |4 X/ n& r9 ^ @9 R! s: I" F% L3 n
瘜冽嚗憒nginx摰鋆頝臬銝臬/www/nginx銝嚗敶靽格孵停憟賬
, J7 c0 O* m& c$ o. h/ h7 nchmod 775 /etc/rc.d/init.d/nginx #韏鈭扯chkconfig nginx on #霈曄蔭撘箏臬/etc/rc.d/init.d/nginx restart service nginx restart單迨nginx摰鋆撠得k鈭嚗雿銝支葵桅嚗" |2 O* N2 v3 F6 A8 W' u
1嚗舀湔寥霈已eb寧桀/www/web桅 2嚗臭php游嚗暺霈孓ginx臭霈小hp敺 撖嫣1嚗nginx暺霈已eb寧桀 nginx摰鋆頝臬銝html隞嗅允嚗隞祆隞孵/www/web桀銝 餈/www/nginx/conf桀銝嚗vim nginx.conf嚗撠
, w3 q: `/ f7 Q: z location / {
. W/ V" s$ q7 G6 V5 I$ v g2 X root html;5 \" x2 P! e8 M( I9 b2 G3 G$ K
index index.php index.html index.htm;5 _) E* r4 }; Q' Y0 [
}' o7 \& G2 U/ @. T4 @. \ m
靽格嫣蛹嚗
% m$ X: Q$ r8 y3 M. R4 x$ q n# l- {
location / { root /www/web; index index.html index.php; } 瘜冽嚗憓鈭撖隘ndex.php霂怒撠 6 j) j/ f. f4 a4 b( P
location ~ \.php$ {7 D2 F# s& b: n4 j5 P0 ~
root html;
i: D b* J: m4 B) g3 | fastcgi_pass 127.0.0.1:9000;
7 P( q$ Z" P) E4 w5 y fastcgi_index index.php;
( X! p$ t: J* f2 g9 I: J fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;* V' b7 X! l% B
include fastcgi_params;5 |: f/ R& C. d; P
}1 ?# `5 q& q _+ Q* w
靽格嫣蛹嚗
! H" Z, Z( [6 N
, m5 w0 L3 K7 _6 L+ S3 G% ~ 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閫蝻拙僎餈唳桀嚗扯嚗
& p7 H2 Y/ ]/ E g: A N0 E0 v#cmake -DCMAKE_INSTALL_PREFIX=/www/mysql 銋make make install摰鋆摰鋆摰瘥閬隞乩銝芯嚗1嚗璉/etc/銝臬血皂y.conf, 憒霂餈mv賭誘孵銝 my.cnf.backup ps嚗甇斗郊撉日撣賊閬嚗嚗嚗 2嚗撱榦ysql冽瑕蝏 #/usr/sbin/groupadd mysql& U4 M1 u. q Z1 M; z7 [. N
( v( s/ b0 X- {* q- j, j
#/usr/sbin/useradd -g mysql mysql 憓mysql冽瑕蝏
+ ?# G7 F3 \; D) z3 R& r 扯 cat /etc/passwd 亦冽瑕銵2 m, S* v* v( n9 x$ d
cat /etc/group 亦冽瑞銵 chown -R mysql:mysql /www/mysql靽格雋ysql摰鋆桀& l' u2 q7 ?( k
3嚗餈/www/mysql,撱箇頂蝏芸蒂唳桀 scripts/mysql_install_db --basedir=/www/mysql --datadir=/www/mysql/data --user=mysql1 N$ X f n$ } B6 i' J8 E1 S- r
4嚗瘛餃∴臬決ySQL cp support-files/mysql.server /etc/init.d/mysql
" R6 m6 t4 f: S, Y" a! |chkconfig mysql on
0 d+ z8 [1 p* y0 K- w \6 Y. Aservice mysql start --臬決ySQL- t* s4 C2 k) M8 V; s% `6 o9 \! y& `
5,霈曄蔭root撖 銝箔霈拐遙雿唳寥質賜皂ysql/bin銝賭誘嚗vim /etc/prifile 瘛餃嚗 PATH=/www/mysql/bin: $PATH
& _* k' `# O- V& x1 s6 cexport PATH; W% y+ n" r1 [! E
靽摮source /etc/profile 扯嚗
) l+ @6 i, r% J7 e- Imysql -uroot mysql> SET PASSWORD = PASSWORD('root');
E& R* t/ U$ q5 X" d3 h1 o4 K+ I4 F$ Q6 s
霈曄蔭root冽瑞撖銝氳oot 6嚗銝箔舀餈蝔霈輸格唳桀嚗扯嚗
7 {7 G4 i/ N) g6 J, [0 {mysql> grant all on *.* to xroot@"%" identified by "xroot; mysql> flush privileges; //湔唳 餈瑕停撱箔銝銝芰冽瑕銝漩root嚗撖銝漩root冽瘀臭誑餈蝔霈輸格唳桀 ,摰鋆php(php-fpm)閫撟嗉交嚗
. X1 K, H% p3 E" h#./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嚗 6 m2 K9 R5 ?4 N
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+ o3 Y7 h5 z+ C* B. W/ n
. Y- I5 ?8 D7 O$ P0 g
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
& R# a) F) _( [- |* aCreate /etc/yum.repos.d/php-fpm.repo file and add:* M% t$ }3 J; C$ L' S9 ? ?9 S4 Z8 D
- [nginx]6 C! X" X3 ~; b {2 ]+ r
- name=nginx repo7 e2 y( K. } {; `$ X/ I$ h+ _
- baseurl=http://nginx.org/packages/centos/$releasever/$basearch/3 O4 l' }) O! M# `% b
- gpgcheck=0# i6 L1 s8 P0 \. i5 p+ x
- enabled=1
銴鋆賭誨蝣
3 r, s/ }9 E! t; u0 N# hyum --enablerepo=remi,remi-test install php-fpm
, P1 P( w% [+ }1 m$ j: G' M, X# {2 {/ H* X1 o6 h; z: `
8 s6 h8 T9 {! D3 r0 Z3 Z
鈭嚗摰鋆svn蝵峰ost嚗commit甇斗郊雿冽臭誨瞞tp嚗嫣噶撘鈭箏撘撟嗅甇乩誨臭誑湔仿餈yum摰鋆喳胯 # rpm -qa subversion //璉交臬西芸蒂鈭雿祉svn
" C. X) H2 B) h 嚗yum remove subversion //貉蝸雿祉svn B. S# I# \* E' T% a+ c9 D
# yum install httpd httpd-devel subversion mod_dav_svn mod_auth_mysql //摰鋆svn$ b$ K1 G2 B" m1 I5 U
餈# 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]
X2 Y8 p! t: j. f3 \5 F2 x# harry = harryssecret9 o" t& `( E% {
# sally = sallyssecret( c) ]0 ?3 D* ]0 b+ v% X
wangning=wangning
! {4 @+ ~' r% H* Jyanzi=yanzi' J7 d" R7 C9 W4 e" |
#vim authz //霈曄蔭
( Z- U* K% B/ [4 N, z. D% U. ~5 g[/] wangning = rw yanzi = rw # &joe = r # * = #vim svnserve.confanon-access = none
/ ~3 S% L: U; U( F' o; C. Bauth-access = write
9 K" K4 e, [2 M) E+ m) \5 E/ k### The password-db option controls the location of the password- v% r2 |$ i- n
### database file. Unless you specify a path starting with a /,4 i, {" f+ m- t5 T
### the file's location is relative to the directory containing
# Q" v$ ?: D: V3 C### this configuration file.
m C+ r( P6 A, a1 K### If SASL is enabled (see below), this file will NOT be used.
( F5 ?' y; l& Y7 r) _. h### Uncomment the line below to use the default password file. H) \9 z& A& f
password-db = passwd" M: M; w) N6 i; J( G0 O3 X
### The authz-db option controls the location of the authorization; I4 |1 \7 g, L4 s# p
### rules for path-based access control. Unless you specify a path x; y% N" o9 i* @0 I, M+ t
### starting with a /, the file's location is relative to the the
9 |. E( C% t7 \" k### directory containing this file. If you don't specify an% {% L$ z) {) m5 g
### authz-db, no path-based access control is done.
% u4 C' S9 d6 R- v H. g### Uncomment the line below to use the default authorization file.
8 l8 o Z6 y% R3 E0 m2 }& dauthz-db = authz* `- u0 n, Y6 d' q% `/ ^% \2 W5 _
### This option specifies the authentication realm of the repository.+ \( ~; I0 I6 [( e7 L
### If two repositories have the same authentication realm, they should
2 f) e+ L( r! d1 M$ I### have the same password database, and vice versa. The default realm
# r0 S, B% x9 ^" p6 s& n" V### is repository's uuid.
( T1 }- i7 s0 Q$ t1 r* i8 {. Trealm = My First Repository
8 t% s. U* {- T6 @. _6 W 瘜冽嚗銝Z鈭銵V賣蝛箸潦 3,臬典甇┬vn #svnserve -d -r /www/wwwwvn //臬究vn. P c8 u( d3 J6 u/ [
#killall svnserve //甇4 \6 `$ o0 J, ^- N7 F5 M
敺臬究vn嚗臭誑典X霂鈭 svn checkout svn://192.1.15.222 --username xxx
+ ?# f& a2 d7 b7 _& O: g+ { 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+ v) y& q+ R4 ]3 B
b, # cd /www/wwwsvn/hooks/,嗅cp post-commit.tmpl post-commit vim post-commit嚗券Z伐
& P8 K$ q0 q6 Zexport 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" :
; p2 S( r9 c: ]$ K, V1 L#system-config-securitylevel 豢DISABLE敺OK嚗敹璈 , \$ ]# w. {( X2 K, x8 L
瑁setenforce 0撠勗臭誑急踝瑁setenforce 1撠勗臭誑急 vi /etc/sysconfig/selinux SELINUX=enforcing 寞--> SELINUX=disabled
. ]1 ^, q8 g8 N8 X/ D. v1 s) xvi /var/log/audit/audit.log ( tail -f /var/log/audit/audit.log) 亦 SElinux 雿憿3 ^" Y* i: E+ X: E8 l8 n9 F
|