1

I have installed WordPress on LEMP stack on DigitalOcean and noticed that all the 404 images on the pages are taking too long to show a 404 error message.

Those images are not existing so it will give 404 errors but it just takes too long (4 to 6 seconds) to show a 404 error message.

enter image description here

Any suggestions?

3
  • 1
    You can tell the webserver display a static html file (404.html) on 404.
    – birgire
    Commented Dec 22, 2015 at 9:00
  • @birgire Thank you for the comment. I don't think I'm fully understanding what u meant. Would you mind giving me a link of page has more information about your suggestion?
    – Ohsik
    Commented Dec 23, 2015 at 23:54
  • Check error_page in NginX.
    – birgire
    Commented Dec 24, 2015 at 1:15

1 Answer 1

1

While it is impossible to pinpoint why it takes so long without access to your server, the core issue is that when the webserver do not find a file it will execute wordpress to handle the URL, and as the URL is unlikely to match any content it will result in a generation of a 404 wordpress page which is obviously much slower than returning 404 at server level.

Usually it is not a problem as pages generated by wordpress rarely contain images which do not exist, but if this is an actual problem you can adjust you webserver config (.htaccess for apach) to not propagate unresolved image urls to wordpress.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.