How can I troubleshoot an nginx 404 error?

June 5, 2016 291 views
Nginx WordPress Ubuntu

I am attempting to set up a droplet to host a few low-traffic WordPress sites. Here are my steps so far:

At this point, everything worked great. Next step was to point the live/real domain at this server using Cloudflare. Since the Wordmove push had worked previously, I decided to delete all the WordPress files from the server so I could update Wordmove's Movefile with the appropriate live URLs and push again.

I also created a new file – for the new URL – in /etc/nginx/sites-available and symlinked it to /etc/nginx/sites-enabled, as I had done with the test domain. I edited this new file to work with pretty WP permalinks. I removed the file relating to the test domain. So now in /etc/nginx/sites-enabled there is only one symlinked file, and it includes the line listen 80 default_server; I believe this is correct.

All the WP files are in the correct location and wp-config.php has the correct database details. As far as I'm concerned I should now be able to view this site at the new domain. However it returns an nginx 404 page.

I updated the DNS around 24h ago but if I ping either example.com or www.example.com it shows the correct IP address of my server. Also I used an online propagation check which reckons it's done. I don't think is a DNS problem.

How can I figure out why this isn't working?


1 Answer

I've solved this myself, and the issue was my fault.

When I edited my Wordmove Movefile to work with the new domain name, I specified the incorrect wordpress_path. I had /var/www/example.com whereas the root specified in /etc/nginx/sites-enabled/example.com was /var/www/example.com/public_html. So where I confidently stated in my original question that "All the WP files are in the correct location", I was wrong.

Have another answer? Share your knowledge.