Skip to main content

nginx serves wrong domain site. It doenst shows default site if no configuration applies [Resolved]

I have 3 domains that are pointing to my server and the server runs confluence and jira application from atlissan.

For whatever reason, my nginx is acting strange.

I have the default nginx configuration not touched. If I visit, nginx shows me the default nginx page.

I have a configuration for jira that is enabled in the sites-enabled:

server {
   listen ssl;
   server_tokens off;
   location / {
       proxy_set_header Host $server_name;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forewarded-For  $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header Authorization "";
       proxy_pass; #Jira port

   # certbot ssl settings
   #htaccess settings

server {
    if ($host = {
        return 301 https://$host$request_uri;
    return 404;

Now, If I visit, I am getting jira served.

That are my only two configurations. The point is, that I am getting jira served, even if I visit from If I change the port in the proxy pass to the confluence port, I am getting confluence served. Why is nginx picking up if I come from Even Jira tells me that I am comming from

all domain entries are A records to the IP of the server

Question Credit: Patrick Schocke
Question Reference
Asked July 13, 2019
Tags: nginx
Posted Under: Network
2 Answers

nginx documentation doesn't tell that it supports domain names in listen directives. You should only use port number there, unless you have a specific need to bind nginx only to a specific interface.

credit: Tero Kilkanen
Answered July 13, 2019
Your Answer