Why is my Nginx server redirecting to the incorrect page?

Linode Staff

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

Not sure if it’s relevant to you, but I once had the same issue when I enabled “http2” on a plain HTTP port.

I didn’t realise at the time that http2 is only applicable to HTTPS.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct