Nginx安装第三方模块check_upstream-module

 

nginx版本:

nginx-1.6.3.tar.gz

check_upstream-module下载链接:

https://github.com/yaoweibin/nginx_upstream_check_module

 

一开始试了nginx-1.10.1和nginx1.11.1,在打补丁的时候都报错了,nginx1.6.3打补丁成功

 

步骤:

下载nginx-1.6.3.tar.gz,nginx_upstream_check_module-master.zip之后,我放在/root目录下

 

1.解压nginx-1.6.3.tar.gz和nginx_upstream_check_module-master.zip

#tar -zxvf nginx-1.6.3.tar.gz

#unzip nginx_upstream_check_module-master.zip

2.打补丁

#patch  -p1 < /root/nginx_upstream_check_module-master/check_1.5.12+.patch

因为我用的是1.6.3版本的nginx,所以这里用1.5.12+

#cd nginx-1.6.3

#./configure --prefix=/mnt/nginx --with-http_ssl_module --add-module=/root/nginx_upstream_check_module-master

#make && make install

 

3.之后就是改配置文件啦

 

[root@iZ234awldzeZ nginx]# cat conf/nginx.conf
 

#user nobody;
worker_processes 2;

error_log logs/error.log;
pid logs/nginx.pid;


events {
use epoll;
worker_connections 12500;
}


http {
include mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

upstream cluster {
server 192.168.10.11:8080 max_fails=1 fail_timeout=3s;
server 192.168.10.12:8080 max_fails=1 fail_timeout=3s;
# server 192.168.10.13:8080 max_fails=1 fail_timeout=3s;
check interval=10000 rise=3 fall=3 timeout=1000 type=http default_down=true;
check_keepalive_requests 1;
check_http_send "HEAD / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}

server {
listen 80;
server_name localhost;
charset utf-8;
index index.html index.htm;
root /mnt/nginx/html/ews;#nginx上的项目根目录
location / {
proxy_pass http://cluster;
proxy_buffer_size 64k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 128k;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;

root /mnt/tomcatins/tomcat8080/webapps/ews;
}

location ~ .*\.(php|jsp|cgi)?$
{
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://cluster;
}



location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root /mnt/nginx/html/ews;
expires 3d;
}


location /check-status {
check_status;
access_log off;
allow all;
# deny all;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

}


# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}

 

你可能感兴趣的:(nginx,nginx)