Hi everyone,
I’m a bit confused as to where exactly my problem lies. I have a custom domain name, which I have connected to the DO nameservers. I’m reasonably sure this is set up correctly since as the title states, when I go to that website, I get the “welcome to nginx” default page.
However, when I go to my DO droplet’s IP; http://192.241.148.5/, I can see my webapp correctly.
I suspect the problem lies with my nginx sites-available/philheijkoopsite file (that’s what I’ve called it), containing the following:
server {
listen 80;
server_name 192.241.148.5;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/phil/mysite;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/phil/mysite/philheijkoopsite.sock;
}
}
Is the server_name not specific enough? I have checked and the .sock file has been created, gunicorn is running correctly. I’ve tried restarting nginx, none of that has changed my currently problem, anyone have any ideas?
update I have added a new rule to my sites-available/philheijkoopsite file:
server {
listen 80;
server_name .philheijkoop.com;
return 302 $scheme://192.241.148.5;
}
Which now redirects my incoming traffic to my IP, and thus they at least get to the web app. However, this does the opposite of what I want. If I reverse the current set up in my file, ie have the url redirect to my IP, it will do that, but the IP still serves a 400 Bad Request error.
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!
This comment has been deleted
Hi there,
As long as you see the Welcome to Nginx page, your domain is pointing to the correct server. Now, we need to make it point to the correct page.
The first thing I noticed is the server_name directive. Do you have special reason why is it set to the Droplet’s IP address?
Try to replace IP with your domain name such as:
...
server_name example.com
...
Restart Nginx by running the systemctl restart nginx and then give it a try. Maybe, you’ll have to clear browser cache, or to use the incognito mode.
The rule you added later isn’t needed, it should work out-of-box. For more info how to set up this, I recommend you to look at the How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04 tutorial. If nothing helps, you can take a look at the How To Troubleshoot Common Site Issues on a Linux Server tutorial.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
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
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.