I am building a server on Ubuntu using Nginx + Gunicorn + Django.
I have a domain name registered with godaddy that redirects to the IP of the server. The Nginx configuration looks like this:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name mydomainname.com www.mydomainname.com localhost;
location / {
proxy_redirect off;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://unix:/path/to/my/socket.sock;
}
}
When I type the domain name in the browser, I get correctly redirected to the server. However, the url in the browser now displays the IP instead of the domain name.
How can I make the server display the domain name instead of the IP?
(Godaddy provides an option to do this by using forward masking, but I have been advised not to use this, and the browser complains about cross-origin problems anyway when I try this approach.)
I'm not even sure if I need to change something in Nginx or Gunicorn or Django.