Docker Nginx反向代理支持websocket
upstream rancher {
server rancher:80;
server rancher:443;
}
server {
listen 80;
listen 443 ssl http2;
ssl_certificate /usr/local/nginx/conf/ssl/rancher.akiraka.com.pem;
ssl_certificate_key /usr/local/nginx/conf/ssl/rancher.akiraka.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
server_name rancher.akiraka.net;
if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
location / {
proxy_pass https://rancher;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 启用支持websocket连接
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
版权声明:
作者:Akiraka
链接:https://www.akiraka.net/linux/nginx/137.html
来源:Akiraka
文章版权归作者所有,未经允许请勿转载。
THE END
0
二维码
海报
Docker Nginx反向代理支持websocket
upstream rancher {
server rancher:80;
server rancher:443;
}
server {
listen 80;
listen 443 ssl http2;
ssl_certificate /usr/local/nginx/con……
文章目录
关闭