技术解析

nginx proxy_pass 端口问题
0
2021-05-19 21:17:07
idczone
server
    {
        listen 443 ssl http2;
        server_name host.com;
        ssl on;
        ssl_certificate 抗投诉服务器/usr/local/nginx/conf/host.com_crt/host.com_bundle.crt;
        ssl_certificate_key /usr/local/nginx/conf/host.com_crt/host.com.key;
        index index.html;
        root /var/www/default;
        include enable-php.conf;
        location /web {
            # proxy_pass http://127.0.0.1:10121;
            proxy_pass http://127.0.0.1:$server_port;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }
        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }
        location ~ /.well-known {
            allow all;
        }
        location ~ /\.
        {
            deny all;
        }
        #access_log  /var/wwwlogs/host.com.log;
    }

配置如上 wss://host.com/web:10121

并没有转发到 proxy_pass http://127.0.0.1:10121;

$server_port 好像没起作用

写死 proxy_pass http://127.0.0.1:10121; 是可以的。

我哪里姿势不对了= =


proxy_pass http://backend;
proxy_set_header Host $host:$server_port;

数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服