Question

Apache errors (No matching DirectoryIndex...)

Yesterday and today, my site’s traffic dropped by almost 100%.

I checked and the site is still indexed on Google and it still ranks for its main keywords. So that’s not the issue.

Then I noticed my site has been loading very slow. So I checked the error log and I see a lot of errors in the apache error log.

Example erros:

AH01276: Cannot serve directory /srv/users/serverpilot/apps/sitename/public/wp-content/uploads/2021/05/: No matching DirectoryIndex (index.html,index.htm,index.php) found, and server-generated directory index forbidden by Options directive

[Tue May 11 10:22:52.161451 2021] [core:error] [pid 15803:tid 140383480702720] (36)File name too long: [client 87.102.119.16:0] AH00127: Cannot map HEAD /free-software-download-sites/@2x.data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDhweCIgaGVpZ2h0PSI0OHB4IiB2aWV3Qm94PSIwIDAgNDggNDgiIHZlcnNpb249IjEuMSIge…This (the charactors) continues for a few paragpahs

I haven’t changed anything in the past few days. Didn’t mess with any settings or anything like that.

I did update a few plugins including: Breeze cache plugin EWWW Image Optimizer Really Simple SSL

It’s a WordPress site on Ubuntu 16.04.1 x64. I am using ServerPilot to manage the server.

I was hoping someone could help me and point me towards the right direction. Thank you very much in advance.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

KFSys
Site Moderator
Site Moderator badge
May 14, 2021
Accepted Answer

Hi @saeeddarabi,

As I promised, I’m posting this answer explaining Apache Workers and why I think they can be the source of the slowness you’ve been experiencing recently.

So first, what are Apache Workers and what are they used for:

Imagine you are in a cinema, and there are 300 chairs inside. Those are the Apache Workers and the movie is your Webiste. If someone wants to watch the movie(your website) they need to sit in the chair (Apache Workers). If all 300 chars are taken, the 301 person needs to wait for someone to leave in order for them to sit and watch the movie. That’s how ApacheWorkers work. Once all ApacheWorkers are taken, a new person that wants to open your website waits for a spot to be open and only after that they can see your website.

Usually, these limits are set by 256 by default but they can be increased.

You can open your Apache configuration file. In there you should see something similar to:

ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000

Increase both the ServerLimit and MaxClients options, restart Apache, and see if this would solve your issue.

It’s possible they do not exist (haven’t been added) and the default values are the ones above. Adding them to the prefork content of apache mods should be fine as well.

Don’t forget to restart Apache afterward.

Regards, KFSys

alexdo
Site Moderator
Site Moderator badge
May 12, 2021

Hello @saeeddarabi

If all the Apache errors are for no matching index in the wp-content folder this is fine, because you wouldn’t expect to have an index file in public/wp-content/uploads/2021/05

Do you have some custom rewrite rules in the .htaccess access? That will explain the second error, but this can also happen if some robot is crawling the site and it’s not following the redirection. You can also increase the LimitRequestLine Directive in Apache but this should only be a temporary solution since the LimitRequestLine directive can help you in case of denial of service attacks and etc.

Regards, Alex

KFSys
Site Moderator
Site Moderator badge
May 12, 2021

Hi @saeeddarabi,

Looking at the errors, both are not and should not be related to your website loading slow, most probably the issue is somewhere else.

Nevertheless, let’s explain the errors you see just so that you are aware what they are from.

The first error - No matching DirectoryIndex shows that there is no index file (index.html,index.htm,index.php) inside /srv/users/serverpilot/apps/sitename/public/wp-content/uploads/2021/05/ and as such can’t server the directory. This is not a problem, most probably someone tried to load the directory directly.

The second error - (36)File name too long. You are running into a limitation of the underlying file system. Most OS have a Maximum filename length of 255 bytes. Thus, when apache and/or your rewrite rule checks if the file exists an error is returned to apache by the operating system.

With Apache, if you put rules such as this in the .htaccess file, it’s too late to work around the problem. Apache will have already attempted to stat the long filename thus throwing the file system error '(36)File name too long. I’ll recommend changing the URL format of your WordPress Website to a maximum of 255 characters.

Now, let’s review the slow website issue. I believe it’s related to something else rather than the above. When you SSH to your droplet and type in:

free -mh

and

w

How much Free memory you see and how much load do you see?

Addiionally, the websites not working might be related to ApacheWorkers being full so I’ll recommend checking this possibility out as well.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel