Nginx 1.20配置多域名及WebSocket

Freeder
阅读 171
server {
    listen       80;
    server_name  www.xxxx.com;

    #只接受GET,POST请求
    if ($request_method !~* GET|POST) {
        return 403;
    }

    charset utf-8;

    location / {
        proxy_pass http://localhost:8080;
        # 以下支持 WebSocket
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }
}
回到顶部