1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/bash
#!/bin/bash
#author xieping
#date:2015-03-31 16:00
#check the OS
nginxdir=
/usr/local/nginx
nginxlog=
/home/wwwlogs/
package=
/root/repo/
htmldir=
/home/wwwroot/default
ipaddr=`
ifconfig
|
grep
"inet addr"
|
awk
'{print $2}'
|
awk
-F:
'{print $2}'
|
awk
'NR==1{print}'
|
awk
-F.
'{print $4}'
`
killall nginx
userdel www
rm
-rf
/usr/local/nginx
#install rpm
for
i
in
gcc pcre* zlib zlib-devel openssl openssl-devel links patch
make
cmake gcc gcc-c++ gcc-g77 flex bison
file
libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel
bzip2
bzip2
-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap diffutils
do
yum
install
-y $i
done
#install nginx
useradd
-M -s
/sbin/nologin
www
cd
$package
echo
"==========nginx download============="
wget http:
//nginx
.org
/download/nginx-1
.6.2.
tar
.gz
tar
-zxf nginx-1.6.2.
tar
.gz
#install pcre
echo
"==========pcre download============="
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
wget http:
//syserp
.qinqinbaby.com:110
/pcre-8
.35.
tar
.gz
tar
-zxf pcre-8.35.
tar
.gz
cd
pcre-8.35
.
/configure
&&
make
-j4 &&
make
install
#install zlib
cd
$package
wget http:
//zlib
.net
/zlib-1
.2.8.
tar
.gz
tar
zxf zlib-1.2.8.
tar
.gz
cd
zlib-1.2.8
.
/configure
&&
make
-j4 &&
make
install
#INSTALL NGINX
cd
$package
cd
nginx-1.6.2
.
/configure
--prefix=
/usr/local/nginx
--with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_gunzip_module --with-pcre=
/root/repo/pcre-8
.35 --with-zlib=
/root/repo/zlib-1
.2.8
make
-j4 &&
make
install
|
1
2
3
4
5
6
|
wget -c http:
//soft
.vpser.net
/lnmp/ext/init
.d.nginx
mv
init.d.nginx
/etc/init
.d
/nginx
chmod
+x
/etc/init
.d
/nginx
service nginx restart
/sbin/iptables
-I INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables-save
|
1
2
3
4
5
6
7
8
9
|
a=`
netstat
-lantup |
grep
nginx`
echo
$a
if
[ $? == 0 ];
then
echo
"nginx install is ok!"
echo
$a
else
echo
"nginx start fail! plase retry!"
exit
1
fi
|
本文转自谢无赖51CTO博客,原文链接:http://blog.51cto.com/xieping/1630922
,如需转载请自行联系原作者