I'm having some really strange behaviour on one of my Debian servers. When requesting stuff.com ( example ) or stuff.com/image.jpg, let's say 50% of the times I have the correct response, the other 50% of times I have an 404, in case of the image, if I'm requesting a normal HTML file I get the default page of apache.

It all started when I created a new virtual host this morning, configured the DocumentRoot as usual and everything else, and suddenly I start to get some 404 on the images in between refreshes, and sometimes I would get the default page of apache.

Virtual Host Config:

<VirtualHost *:80>
       ServerAdmin webmaster@localhost
       ServerName stuff.com
       DocumentRoot /var/www/html/stuff/stuff-test
       <Directory /var/www/html/stuff/stuff-test >

       Options -Indexes +FollowSymLinks
       AllowOverride All
       Require all granted

       ErrorLog /var/log/apache2/stuff/stuff/error.log
       CustomLog /var/log/apache2/stuff/stuff/access.log combined


Default config:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

This was a complex site made with Symfony, so I thought it could be related to that, so installed on another server and everything worked. Then we started to cut down even more our possibilites, and now we only have an index.html and an image.jpg on the folder and it still happens the same thing.

We tried everything except restarting Apache with service apache2 restart, we usually use reload.

Things to note, we have 97 virtual hosts configured on this server, we increased the level of all logs, apache ( to trace8 ), on the virtual host in question and on the default virtual host.

We also checked dmesg, /var/log/messages, /var/log/kern.log, /var/log/syslog.

And nothing interesting appears on any of those logs when the requests fail to hit the virtual host and go to the default virtual host.

Another interesting fact or not, is that this only happens to new virtual hosts, we tried to create a bunch of them all with the same result, but on the old ones ( created before today ), everything is working perfectly without a problem.

Nothing was changed on the server ( last change was 3 of December ), no update to any software, no restart, nothing.

We are going to restart apache tonight, don't want to risk restarting apache during the day and suddenly all sites go down. And see what happens.

Anyone has any idea?

Things we checked, not by any special order:

  • Restarted php-fpm, but it happens while requesting an single file or an *.html file, so it's not from there.
  • Checked ulimit to make sure that everything was ok and we were not reaching any limit. - Scoured every single log file that we could find, that could points anywhere and couldn't find anything.

Versions of software: Debian: 10.2

Apache: Apache/2.4.38 (Debian)

PHP: 7.2.34 ( not that it matters )

  • 1
    Please do repeatedly curl -v http://stuff.com from the same Debian, does an expected result differ from an unexpected result? (other than html body itself) – kubanczyk Jan 19 at 20:31
  • 1
    Yeah it does, restarting apache finally solved the problem. – Tio Jan 21 at 11:57

The solution, was to simply restart apache.

Like I read somewhere here, very rarely the only solution is to restart apache.


You should run apachectl -S to check the order in which the virtualhost are loaded and to check if your virtualhost is correctly loaded.

  • The order was good, I even tried to load it first than the default conf, and still nothing. – Tio Jan 18 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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