By Ben Bishop
With my WordPress sites on DO VPS, when a 404 is reached the nginx 404 page is displayed rather than the WordPress one I would expect.
All the results in Google are quite old and relate to using permalinks and then the site 404ing. I am delighted to say that WordPress permalinks are working fine with my sites so its not connected to that.
Any suggestions?
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!
Weird. Does WP act normal in all other respects? If so, then the only thing that I can think of is… <br> <br>If you’re running Ubuntu, look in <code>/etc/nginx/sites-enabled</code> Then, execute <code>cat [yoursite]</code> <br> <br>Do you have a line that reads <code>error_page 404 /404.html;</code>? If so, change the location to your WordPress directory that contains the 404 page you want.
nano /usr/local/apps/nginx/etc/conf.d/webuzoVH.conf
# DO NOT EDIT. AUTOMATICALLY GENERATED BY WEBUZO.
server {
listen 80;
server_name tutorialcentos.com www.yourdomain.com;
# The Document Root
root /home/user/public_html;
error_log /usr/local/apps/nginx/var/log/yourdomain.com.err;
access_log /usr/local/apps/nginx/var/log/yourdomain.com.log main;
include /usr/local/apps/nginx/etc/conf.d/common;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
Hi thanks both of you for your responses. @Pablo I didn’t want to have to explicitly set each 404 for my sites incase the theme changed. <br> <br>I realised I was explicitly requesting Nginx to handle the 404 pages rather than let WordPress handle them. I had the following set in my conf for each site in sites-enabled. <br> <br>fastcgi_intercept_errors on; <br> <br>http://wiki.nginx.org/HttpFastcgiModule#fastcgi_intercept_errors <br> <br>Setting this to off (+ removing the redundant ‘location’ for the 404) resolved this issue for me. Thanks again both.
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.