我的云实例上安装了nginx 1.9.4。但我无法使用" sudo service nginx start"来启动nginx。何时启用粘性模块但是当它被删除时,我能够启动它。有没有人知道造成这个问题的原因是什么?
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/;
}
}
答案 0 :(得分:1)
而不是使用粘性会话尝试处理根据每个客户端重用相同服务器IP的标准方法:
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;
}