无法在启用粘性模块的情况下启动nginx 1.9.4 [英] Unable to start nginx 1.9.4 with a sticky module enabled
本文介绍了无法在启用粘性模块的情况下启动nginx 1.9.4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在云实例上安装了nginx 1.9.4.但是启用粘性模块后,无法使用"sudo service nginx start"启动nginx.但是将其删除后,便可以启动它了.有谁知道导致这个问题的原因?
I have nginx 1.9.4 install on my cloud instance. But I'm unable to start nginx with "sudo service nginx start" when sticky module is enabled. But when this is removed I am able to start it. Has anyone got an idea about what's causing this issue?
upstream uesconf
{
sticky;
server xxx.xxx.xxx.xxx:9443;
server xxx.xxx.xxx.xxx:9443;
server xxx.xxx.xxx.xxx:9443;
server xxx.xxx.xxx.xxx:9443;
}
server {
listen 80;
server_name xxx.xxx.xxx;
rewrite ^/(.*) http://xxx.xxx.xxx/$1 permanent;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
}
server {
listen 443;
server_name xxx.xxx.xxx;
ssl on;
ssl_certificate /etc/nginx/conf.d/keys/xxx.crt;
ssl_certificate_key /etc/nginx/conf.d/keys/xxx.key;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
client_max_body_size 20M;
location / {
index index.html;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_read_timeout 5m;
proxy_send_timeout 5m;
proxy_pass https://uesconf;
proxy_redirect https://uesconf https://xxx.xxx.xxx/;
}
}
推荐答案
不是使用粘性会话,而是尝试根据每个客户端使用标准方法来重用同一服务器IP:
Rather than using sticky session try to handle standard way to reuse the same server IP according to each client:
upstream backend {
hash $remote_addr consistent;
server backend1.example.com;
server backend2.example.com;
}
您的情况如下:
upstream uesconf {
hash $remote_addr consistent;
server xxx.xxx.xxx.xxx:9443;
server xxx.xxx.xxx.xxx:9443;
server xxx.xxx.xxx.xxx:9443;
server xxx.xxx.xxx.xxx:9443;
}
这篇关于无法在启用粘性模块的情况下启动nginx 1.9.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文