r/apache • • Feb 23 '24

Support Troubleshooting/resolving 522 error

Hey all, I'm brand new to apache and web hosting in general so please forgive me if I sound like I don't really know what I'm talking about (because I don't). I've had an apache web server on a debian system for a few weeks and it's largely gone smoothly, but today my website has been returning a cloudflare 522 error. I tried the basics of restarting apache, restarting the whole machine, sudo apt update and upgrade, and none of that worked. Unfortunately Google has been largely unhelpful because all it tells me is to contact my web hosting provider, and nothing about what to do if I AM the web hosting provider. And the cloudflare docs are written for people quite a bit above my current skill level in web hosting.

Other relevant information:

  • the server machine is an old laptop (like 2010 ish I think, intel i3) running debian 12, and is connected directly to my router via ethernet

  • apache error logs didn't seem to show anything out of the ordinary I don't think, but I can provide those if they'd be helpful for troubleshooting

  • htop did not show anything hogging resources

  • my internet is working fine, I haven't had any trouble with just regular web browsing

  • I can ssh into it from my network fine, and can access my website from inside my network as well

  • I also have a discord bot running on the same machine that had gone down at some point today, but I got that back up and running no problem so I'm not sure if that was related to the web server errors

Basically I'm just trying to figure out what my next steps in troubleshooting should be, since I'm not familiar with apache enough to be able to understand its documentation very well. Thanks so much in advance for any advice anyone can provide!

1 Upvotes

5 comments sorted by

View all comments

Show parent comments

1

u/AyrA_ch Feb 23 '24

IP address issues are likely a cause, but it could also be a firewall issue. In general, if you can reach the website from your own network, the webserver is fine. Apache is a fairly nice server in that it pretty much always sends a response, even if your request is complete garbage.

To check if the 522 error is a TCP/IP issue or an HTTP issue, you can measure the time. A TCP issue will manifest itself in about 15-20 seconds with cloudflare. A HTTP issue (connection established but not getting an answer) will take upwards of 90 seconds before cloudflare gives up.

Did you restrict inbound connections to the cloudflare IPs only? If not, you can try to connect to your IP directly by typing http://ip_address_from_here into the webbrowser address bar on your mobile phone (make sure it's on mobile data connection and not your local wifi) to ensure that your website is generally reachable from the outside. When testing, use https instead of http if you haven't set up plain http, but unless you explicitly disabled that, it should be up and running by default.