Easily configure a performant, secure, and stable NGINX server.Learn More
How can I troubleshoot an nginx 404 error?
I am attempting to set up a droplet to host a few low-traffic WordPress sites. Here are my steps so far:
- Create droplet from “LEMP on 14.04” image
- Followed tutorial for Initial Server Setup
- Followed tutorial to set up Nginx server blocks
- Followed tutorial for Additional Recommended Steps
- Created a mysql database & user as described in the WordPress install tutorial
- Pushed a local WP install with Wordmove and ran through the initial install
- Pointed test domain at the server
try_files $uri $uri/ /index.php?$args;to /sites-available/example.com to enable pretty permalinks in WP
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?
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.×