asp.net core mvc在使用nginx做反向代理,如果存在端口号的情况

☆樱花仙子☆ 提交于 2019-12-31 22:28:30

如果默认不是80端口,在加授权后,跳转容易到默认端口,记得在nginx设置中的proxy_set_header   Host $host:$server_port;中加上$server_port,下文中红色字体

server {
    listen        8080;
    server_name   example.com *.example.com;
    location / {
        proxy_pass         http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host:$server_port;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }
}

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!