Aaron Mazie
Aaron Mazie

Reputation: 763

Default NGINX Page On Everything But Last Server Name

I'm trying to connect my DigitalOcean Droplet to my custom domain. It's a Django website. The server_name will only go to the last thing in the list. So, if I have "server_name www.mydomain.com, mydomain.com" www.mydomain.com won't work (goes to the "Welcome to nginx!" page), but mydomain.com will. If I do the opposite, the opposite happens. What do I do for this? This is basically my "/etc/nginx/sites-available/myproject" as it stands:

server {
    listen 80;
    server_name xxx.xx.xx.xxx, mydomain.com;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /root/myproject;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/root/myproject/myproject.sock;
    }

}

The IP doesn't work, but the "mydomain.com" does because it's last. Any idea what might be going on here or how to see? I want to be able to have mydomain.com and www.mydomain.com work.

Upvotes: 0

Views: 31

Answers (1)

AKX
AKX

Reputation: 168824

server_names shouldn't be comma-separated.

Try

server_name 142.93.58.126 mydomain.com;

Upvotes: 1

Related Questions