Question
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 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.
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.
×