nginx代理返回靜態檔案中路徑不帶埠的問題

明月心~發表於2024-11-22

nginx代理返回靜態檔案中路徑不帶埠的問題

修改配置檔案/etc/nginx/nginx.conf
將proxy_set_header Host $host;改為proxy_set_header Host $host:$server_port;

    server {
        listen       8086;
        server_name  localhost;
        #gzip off;

        location / {
            proxy_set_header Host $host:$server_port;    # 這裡加上$host:$server_port
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://10.***.***.46:8086/;
            proxy_set_header  X-Forwarded-Proto  $scheme;
            #sub_filter 'src="/' 'src="http://111.***.***.61:8086/';
            #sub_filter_once off;
        }
    }

相關文章