自动安装带nginx_upstream_check_module模块的Nginx脚本

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

#!/bin/bash

useradd-s/sbin/nologin-M nginx

yuminstallpcre pcre-devel zlib zlib-devel openssl-devel openssl patch gcc -y

mkdir/software;cd/software

wget http://nginx.org/download/nginx-1.4.6.tar.gz

wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz

wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.8.tar.gz

wget https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master-O master.zip

wget https://github.com/zls0424/ngx_req_status/archive/master.zip -O ngx_req_status.zip

tarzxvf GeoIP-1.4.8.tar.gz &&cdGeoIP* && ./configure&&make&&makeinstall

cd/software/&&tarzxvf nginx-1.4.6.tar.gz &&tarzxvf ngx_cache_purge-2.1.tar.gz -C/usr/local/

unzip -d/usr/local//software/master.zip

unzip -d/usr/local//software/ngx_req_status.zip

cd/software/nginx-1.4.6 && patch -p1 </usr/local/nginx_upstream_check_module-master/check_1.2.6+.patch

patch -p1 </usr/local/ngx_req_status-master/write_filter.patch

cat>/etc/ld.so.conf << EOF

include ld.so.conf.d/*.conf

/usr/local/lib

EOF

ldconfig

cd/software/nginx-1.4.6 && ./configure--sbin-path=/usr/sbin/nginx--conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=nginx --group=nginx --with-pcre --with-http_gzip_static_module --with-http_ssl_module --with-http_realip_module --with-http_geoip_module --add-module=/usr/local/nginx_upstream_check_module-master--add-module=/usr/local/ngx_cache_purge-2.1 --add-module=/usr/local/ngx_req_status-master&&make-j2 &&makeinstall

关于nginx_upstream_check的官方参考:https://github.com/yaoweibin/nginx_upstream_check_module/blob/master/README

本文转自 bannerpei 51CTO博客,原文链接:http://blog.51cto.com/281816327/1606723,如需转载请自行联系原作者