dns - Setting up nginx to support custom domain name -


i have django web application hosted on vm debian-based ubuntu os, , nginx reverse proxy + gunicorn webserver.

the dns of web application myapp.cloudapp.net. have cctld mydomain.pk need configured custom domain name web application.

my original registrar supported nameservers. made account on dns.he.net (a free dns hosting provider) host nameservers, , set cname machine.

my problem once set cname point web app's dns, entering mydomain.pk in browser merely shows me generic welcome ngnix! page. whereas, entering myapp.cloudapp.net (or myapp.cloudapp.net:80) in browser correctly opens web application. why isn't setting cname working?

i've talked support staff @ dns.he.net - i've been told cname set correctly, , there might problem nginx configuration.

for instance, here's 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/;     } } 

remove server_name line, it's not needed in nginx unless want serve different content depending on host name receive.

if remove line, nginx answer request arrives server @ proper port (80 in case), coming myapp.cloudapp.net or mydomain.pk in host header.

this assumes there no other configuration in /etc/nginx/sites-enabled catch requests.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -