By tuliokkj
Hello, I bought a domain from GoDaddy and successfully configured it. When I go to http://mysite.com (just an example), I see my site but domain name (mysite) is translated to ip address. I can’t force nginx (it is nginx, right?) to use and show domain name only and not show ip address. It is a django project.
nginx configuration (/etc/nginx/sites-available/mysite):
server {
listen 80;
server_name mysite.com www.mysite.com XXX.XXX.IP.IP;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/tuliokkj/portfolio-test-project;
}
location /media/ {
root /home/tuliokkj/portfolio-test-project;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/tuliokkj/portfolio-test-project/portfolio.$
}
}
django settings:
###SOME UNIMPORTANT STUFF
SECRET_KEY = '###'
ALLOWED_HOSTS = ['mysite.com', 'www.mysite.com', 'XXX.XXX.IP.IP']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': '###',
'USER': '###',
'PASSWORD': '###',
'HOST': 'localhost',
'PORT': '5432',
}
}
DEBUG = False
if I delete ip address from Allowed hosts and nginx server_name list, I will get something like that:

if I add ip address to server_name in nginx configuration file but still without addin it to local_settings, I will get:

I tried many solutions from nginx tutorials, digitalocean tutorials and nothing helped. I’ll share godaddy configuration also:

I haven’t found language change option so I translated it for you:

I don’t even know if it is problem with django settings (I highly doubt it), ngingx (probably) or godaddy (maybe). Tell me if you need some more information for answer.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
On your nginx configuration try server_name .mysite.com only. Then, open another server block like this
server {
listen 80;
server_name [YOUR_IP_HERE];
return 301 $scheme://mysite.com$request_uri;
}
just in case… this is actually never needed.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.