Question

Own domain set up with DNS, only see "Welcome to nginx!"

Hi,

I have deployed a Django app that is serving a REST API on Ubuntu 14.04 through Nginx. Everything works fine when I visit XX.XXX.XXX.XXX/example/api.json.

However, I have bought my own domain and followed the guide to connect it to my droplet, and I have some problems. When I go to mydomain.com I get the “Welcome to nginx” message, and if I go to mydomain.com/example.api.json, I get a 404 Not Found | nginx/1.4.6 (Ubuntu).

What have I done wrong, and how can I start to look for bugs?

Thanks, Christian


Submit an answer


This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to 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.

Accepted Answer

I solved it. I had to add the domain under the settings for nginx, where I previously had the IP. So if anyone else has this problem, type “sudo nano /etc/nginx/sites-available/your_project” and add the domain names after “server_name” (probably both www.example.com and example.com).

@christianborre

Just for reference, you’ll want to setup a server block for each domain that you point to the Droplet.

So if you have domain01.com, domain02.com, etc, you’ll want to setup a new file for each site like so:

/ect/nginx/sites-available/domain01.com.conf
/etc/nginx/sites-available/domain02.com.conf
etc

Any configuration changes or additions requires that NGINX be reloaded or restarted:

service nginx reload
service nginx restart

or if you’re server is using systemctl:

systemctl reload nginx
systemctl restart nginx

If you run in to any issues, you can check the error log which should be located at:

/var/log/nginx/error.log

You can tail the login to pull just a few lines from it – for example:

tail -20 /var/log/nginx/error.log

The above will pull the last 20 lines from the error log.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.