Why is my Nginx server redirecting to the incorrect page?
My website, hosted on an Ubuntu 18.04 Linode and using Nginx is no longer resolving to the homepage. Navigating to the URL now returns a plain HTML page.
The service is listening and the curl returns 200 OK, but I cannot get to the page I'm looking for. How should I be setting up my Nginx server block to correctly direct traffic? Where in the Linode's file structure can I check on this configuration?
2 Replies
I'm sorry to hear that you're having trouble with your website! This Community Questions post goes into detail about the different Nginx troubleshooting steps you can take. I've outlined some of them below.
- View access logs
sudo cat /var/log/nginx/access.log | less
- View error logs
sudo cat /var/log/nginx/error.log | less
- Built-in configuration test
sudo nginx -t
You will want to make sure that your website directory has the correct permissions. We also have an Nginx configuration guide that goes over the default site configuration. This will show you where you can access the files, if the default location is used.
You can also find more information about configuring Nginx in their official documentation. They also have documentation on common mistakes that can be found at the link below.
I hope this information is helpful!
Additional Resources