Reputation: 763
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
Reputation: 168824
server_name
s shouldn't be comma-separated.
Try
server_name 142.93.58.126 mydomain.com;
Upvotes: 1