Problem with configure nginx (I guess) to cooperate with domain and not show ip address.

Hello, I bought a domain from GoDaddy and successfully configured it. When I go to (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 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:


SECRET_KEY = '###'


    '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: Image1

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

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

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

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.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

On your nginx configuration try server_name only. Then, open another server block like this

server {
    listen 80;
    server_name [YOUR_IP_HERE];
    return 301 $scheme://$request_uri;

just in case… this is actually never needed.