I have ASP.NET app hosted at backend IIS (Windows Server 2012 R2) and Debian with Nginx open for public with SSL certificates and so on.
Nginx proxying http://myexample.com
request to HTTP backend without any problems with config:
server {
listen 80;
server_name my.example.com
location / {
proxy_pass http://backend:1234;
}
}
But when I try https://my.example.com
– web browser gets link https://my.example.com/Login.aspx
(which is correct) and then 404 Not Found.
HTTPS Nginx config (I tried with commented lines as well but still 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 log show this:
[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"
Why isn't Nginx proxying GET requests to backend server?
Best Answer
You should use:
That is, without the
=
. Thelocation =
syntax only matches a single URI.See this document for details.