I am assuming that DNS entry for example.com
is pointing to the server whose configuration is shown in the question.
This configuration has three virtual hosts defined:
server {
server_name app.example.com.ar www.app.example.com.ar;
listen 443 ssl; # managed by Certbot
location / {
proxy_pass http://10.10.10.2/;
}
}
server {
listen 80;
server_name app.example.com.ar www.app.example.com.ar;
}
server {
listen 80;
server_name _;
location / {
proxy_pass http://10.10.10.196:80;
}
}
First host is for app.example.com.ar
at port 443 (TLS), which reverse proxies to 10.10.10.2
.
Second host is for app.example.com.ar
at port 80 (HTTP), which returns 404 not found.
Third one has no defined server_name
.
nginx selects the virtual host to use by checking the Host
header in HTTP request, or SNI
field in TLS ClientHello packet.
It picks up the name from the request, and tries to look a matching server
block for the port.
In your case, a request to http://example.com.ar
means nginx tries to search for a block with server_name example.com.ar
where listen
is set to 80
. There is no such block, so nginx uses the default block.
Since there is no server
entry with default_server
specified, nginx will use the first matching server
block as the default to handle the request. In this case it is the second block. In that server block, the action is return 404;
, which you can see in your browser.
To fix the issue, you should configure the proper server_name
in the third block.