Apache2 randomly stops working

Posted July 3, 2019 2.5k views
ApacheUbuntu 16.04

I’m fairly new to Apache2, and I’ve been using it for my website. Most of the time it works flawlessly, however at random times throughout the day it stops working and attempting to access the site returns ERR_TIMED_OUT on Chrome. This happens globally and is not specific to my IP or browser.

The access log mostly contains 502 codes and the error log is flooded with Error reading status line from remote server and The timeout specified has expired

I can’t find any solution to this issue despite how hard I look and it’s been driving me mad for months. It’s also worth mentioning that I have letsencrypt set up, which could be the problem.

Help would be greatly appreciated. Please tell me if there’s any other details I should share.

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.

Submit an Answer
2 answers


According to the error, it seems like that it’s not an Apache issue but an issue with your backend.

Would you mind posting the full error that you see in the error logs?

Also can you let me know what are you using as a backend? And how exactly do you fix this issue when it occurs?


  • Hi Bobby!

    I use Node JS as a backend, but also have a few basic html files in /var/www/html - which stop working as well.
    Despite the system saying that Apache2 is running fine, simply restarting it fixes all the issues (or sometimes just waiting).

    Here’s a little snippet of the error logs.
    I’m noticing that “failed to make connection to backend” pops up quite a bit, so you may be correct.

    • Hello,

      Thanks for providing me with the logs, I think that those connections to the remote servers are causing the issue for you.

      What I could suggest is that the next time your Apache starts timing out, just ssh to the server and run:

      netstat -plant

      That way you would check your connections and you would be able to determine what’s going on.

      Let me know how it goes!

The netstat -plant is a good one. I also had really weird issues with Apache, starting just a day after installing a fresh droplet. Netstat showed that hundreds of ip’s were connecting to :443. After duckduckgo'ing the IP, it was on a list of free Telegram proxies.

So probably the former user of the droplet hosted a free proxy server. Only option is to create a snapshot of the droplet, create a new droplet and delete the current one.

Sadly this will be an issue for the next user which gets this IP ( assigned.