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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#!/bin/bash # nginx default install /usr/local/webserver/nginx nginx_version=1.4.4 lua_version=0.9.2 cache_version=2.1 nginx_name= "nginx-$nginx_version"
nginx_package= "nginx-$nginx_version.tar.gz"
lua_package= "v$lua_version"
cache_package= "ngx_cache_purge-$cache_version.tar.gz"
nginx_soft_path= '/usr/local'
nginx_rpm_package=(gcc.x86_64 lua lua-devel geoip geoip-devel pcre pcre-devel openssl openssl-devel zlib zlib-devel make wget)
nginx_install_path= '/usr/local/webserver'
tar_nginx_module() { cd $nginx_soft_path
if [ -e $nginx_package ]; then
tar -xzvf $nginx_package
else
wget http: //nginx .org /download/nginx-1 .4.4. tar .gz
tar -xzvf $nginx_package
fi
if [ -e $lua_package ]; then
tar -xzvf $lua_package
else
wget https: //codeload .github.com /chaoslawful/lua-nginx-module/tar .gz /v0 .9.2
tar -xzvf $lua_package
fi
if [ -e $cache_package ]; then
tar -xzvf $cache_package
else
wget http: //labs .frickle.com /files/ngx_cache_purge-2 .1. tar .gz
tar -xzvf $cache_package
fi
} install_package() { rpm -qa | grep "rpmforge" > /dev/null
if [ $? == 0 ]; then
echo -n ""
else
wget http: //pkgs .repoforge.org /rpmforge-release/rpmforge-release-0 .5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
fi
for i in ${nginx_rpm_package[*]}
do
rpm -qa | grep "$i" > /dev/null
if [ $? == 0 ]; then
echo -n ""
else
yum install $i -y
fi
done
} nginx_configure() { cd $nginx_soft_path/$nginx_name
. /configure --prefix= /usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_geoip_module --add-module=.. /lua-nginx-module-0 .9.2 --add-module=.. /ngx_cache_purge-2 .1
if [ $? == 0 ]; then
make
make install
else
echo "configure error"
fi
} nginx_mkdir_dir() { if [ -d $nginx_install_path ]; then
echo -n ""
else
mkdir -p $nginx_install_path
fi
} install_package tar_nginx_module nginx_mkdir_dir nginx_configure |
本文转自 Art_Hero 51CTO博客,原文链接:http://blog.51cto.com/curran/1333363,如需转载请自行联系原作者