nginx websocket

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {
     server_name stagsocket.xxx.com;
     listen 443 ssl;
     location / {
         proxy_pass http://127.0.0.1:9502;
         proxy_read_timeout 300s;
         proxy_send_timeout 300s;

         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_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection $connection_upgrade;
     }
    ssl_certificate /usr/local/nginx/conf/ssl/stagsocket/1709484_stagsocket.xxx.com.pem;
    ssl_certificate_key /usr/local/nginx/conf/ssl/stagsocket/1709484_stagsocket.xxx.com.key;
}

Leave Comment

电子邮件地址不会被公开。 必填项已用*标注