我有ASP.NET应用程序托pipe在后端IIS(Windows Server 2012 R2)和Debian与Nginx公开与SSL证书等公共。
Nginx代理http://myexample.com请求HTTP后端没有任何问题与configuration:
server { listen 80; server_name my.example.com location / { proxy_pass http://backend:1234; } }
但是,当我尝试https://my.example.com – 网页浏览器获取链接https://my.example.com/Login.aspx (这是正确的),然后404未find。
HTTPS的Nginxconfiguration(我尝试了评论线,但仍404):
server { listen 443 ssl http2; server_name my.example.com -- SSL part --- location = / { proxy_pass http://backend:1234; #proxy_set_header Host $host; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header X-Forwarded-Proto $scheme; #proxy_redirect http:// $scheme://; } }
Nginx日志显示这个:
[error] 27936#27936: 1* open() "/etc/nginx/html/Login.aspx" (2: No such file or directory), client: IP, server: my.example.com, request: "GET /Login.aspx HTTP/2.0", host: "my.example.com"
为什么Nginx没有将GET请求代理到后端服务器?
你应该使用:
location / { ... }
也就是说,没有= 。 location =语法只匹配一个URI。
详情请参阅此文件 。