【问题标题】:How to forward all requests to .net core app from nginx如何将所有请求从 nginx 转发到 .net 核心应用程序
【发布时间】:2018-11-19 18:17:10
【问题描述】:

我已使用 nginx 将我的 .net 核心 Web 应用程序部署到 Ubuntu 16.04 服务器,我想将所有传入请求发送到我的 .net 核心应用程序。我使用了这里的教程here。我的网站可用/默认文件

server {
listen 80;

server_name example.com *.example.com;

location / {
    proxy_pass         http://localhost:5000;
    proxy_redirect     off;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;   
}   

当我想传递参数以动态更改图像大小时,除了一个操作之外,一切正常

http://example.com/api/files/get/5beffcb65a8e8f1c700a1a22/image?w=400&h=400

在这种情况下,我收到 404 错误。 Nginx 返回的那个错误。我通过 curl 在本地对其进行了测试,并对我的 .net 核心应用程序执行直接请求,它工作正常。

那么如何配置 nginx 以将所有参数的所有请求按原样发送到我的 .net 核心应用程序?

【问题讨论】:

  • 我挖掘了dipper,发现系统日志中有一些错误,例如'gdip'的类型初始化程序抛出异常,我认为这就是问题所在。有人知道怎么解决吗?

标签: nginx asp.net-core .net-core ubuntu-16.04


【解决方案1】:

不要将代理重定向设置为关闭。请参阅此链接以获取说明:

https://unix.stackexchange.com/questions/290141/nginx-reverse-proxy-redirection

【讨论】:

    猜你喜欢
    • 2019-08-29
    • 2020-08-01
    • 1970-01-01
    • 2019-01-20
    • 2019-12-07
    • 1970-01-01
    • 1970-01-01
    • 2017-05-12
    • 1970-01-01
    相关资源
    最近更新 更多