I have a Django web application hosted on a VM with the Debian-based Ubuntu as the OS, and nginx reverse proxy + gunicorn as the webserver.
The DNS of this web application is myapp.cloudapp.net
. I also have a ccTLD mydomain.pk
I need to be configured as a custom domain name for this web application.
My original registrar only supported nameservers. Thus I made an account on dns.he.net (a free DNS hosting provider) to host my nameservers, and set up the CName for my machine.
My problem is that once I set up the CName to point to my web app's DNS, entering mydomain.pk in the browser merely shows me a generic Welcome to ngnix!
page. Whereas, entering myapp.cloudapp.net
(or myapp.cloudapp.net:80
) in the browser correctly opens up the web application. Why isn't setting up the CName working?
I've talked to the support staff at dns.he.net - I've been told my CName is set up correctly, and that there might be some problem with my nginx configuration.
For instance, here's my etc/nginx/sites-available/myproject
file:
server {
listen 80;
server_name myapp.cloudapp.net;
charset utf-8;
underscores_in_headers on;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/myuser/projectpk/project;
}
location /static/admin {
root /home/myuser/.virtualenvs/projectpk/local/lib/python2.7/site-packages/django/contrib/admin/static/;
}
location / {
proxy_pass_request_headers on;
proxy_buffering on;
include proxy_params;
proxy_pass http://unix:/home/myuser/projectpk/project/project.sock;
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /home/myuser/projectpk/project/templates/;
}
}
myapp.cloudapp.net
works correctly, how does theserver_name
line mess up the forwarding when I set up a CName? Or is that not what you're implying? – Mosquito