Getting 503 Service Unavailable - RESOLVED?

Nextcloud version: 16.0.3.0
Operating system and version: Ubuntu 18.04LTS
Apache Version 2.4.29
PHP version 7.2.19-0ubuntu0.18.04.1

The issue you are facing:

Unable to login to either NC webpage OR Linux Client (2.5.2git).
Client gets red banner “No connection to Nextcloud at https://cloud.mydomain.org, Server replied “503 Service Unavailable” to GET “https://cloud.mydomain.org/status.php” and NC webpage just shows " Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.”

My Nextcloud install is running on a 2Gb KVM vps which took some kind of an outage early this morning, and once the node came back up, this malfunction began.

Each time I hit the NC webpage at https://cloud.mydomain.org I get the following errors from /var/log/apache2/error.log

[Sun Jul 28 17:37:40.126643 2019] [proxy:error] [pid 16096] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php7.2-fpm.nextcloud.sock (*) failed
[Sun Jul 28 17:37:40.126764 2019] [proxy_fcgi:error] [pid 16096] [client xx.xx.xx.xx:35996] AH01079: failed to make connection to backend: httpd-UDS

Upon checking the /run/php directory there is nothing in it…

Not sure what got bent when the vps went down unexpectedly…
Prior to this morning, the installation was working fine…

Sometimes the sock file won’t get created, I’ve never really understood why

If you run touch /run/php/php7.2-fpm.nextcloud.sock then change the permissions to you web worker e.g chmod www-data:www-data /run/php/php7.2-fpm.nextcloud.sock it might do the trick.

Tried touching the .sock as root, then chown to www-data:www-data, and now I get the following in /var/log/apache2

[Mon Jul 29 06:44:50.533546 2019] [proxy:error] [pid 22554] (111)Connection refused: AH02454: FCGI: attempt to connect to Unix domain socket /run/php/php7.2-fpm.nextcloud.sock (*) failed
[Mon Jul 29 06:44:50.533832 2019] [proxy_fcgi:error] [pid 22554] [client xx.xx.xx.xx:39454] AH01079: failed to make connection to backend: httpd-UDS

Something sure got blown up when the vps shut down uncleanly…
Help!!

Finally tracked the problem down… the php7.2-fpm.service was in a
failed state. Not sure why, and I’d rebooted the host server quite a few times and apparently that service wouldn’t start each time. But it is running now (for how long I don’t know) and NC is working… fingers crossed…

Thanks!!

1 Like

Thanks for this post @Dave_Frandin, it helped me a lot.

I have Nextcloud Pi running Nextcloud 24.0.6 in a raspberry 4, and after a power loss, I was also receiving 503 - Service Unavailable. No matter how many times I rebooted, the problem persisted.

After ssh’ng into the raspberry, I followed your solution and fixed it by:

$ sudo systemctl stop php8.1-fpm.service
$ sudo systemctl disable php8.1-fpm.service
$ sudo systemctl enable php8.1-fpm.service
$ sudo systemctl start php8.1-fpm.service

Sorry for reviving such an old thread; it’s for future reference, if more people end up with this problem. This thread was the second result on google, searching for “nextcloud 503 service unavailable”.

5 Likes

Thank you for updating this post! Fixed my problem right away.

Having same problem - sudo commands from @volanin did not work for me.

Noticed that I could reach the client interface via direct IP in the browser but not with the pretty URL I set up, that gets the 503. Not sure why that is.

Update from earlier, I can reliably re-create this issue. If I do a fresh image on a raspberry pi4 using the NextCloudPi image, I can set things up, confirm they work, then pull the plug on the pi. On reboot, I can get to the back-end settings console but after login I get the service unavailable error.

1 Like

That’s not entirely surprising. Improper shutdown impact can range from… nothing (lucky) to any number of issues that range from minor (just needing run a manually fsck on a filesystem before it gets remounted read-write from read-only) to more catastrophic.

Unfortunately the behavior is going to be a bit different for everyone.

The bigger clues about what is going on in these situations are often outside of Nextcloud and in the system boot-up logs…

1 Like

Thank you! Trying to figure out how to make NextCloud work on the Pi in a resilient way. Some of the other systems I’ve worked with (eg PiHole) seem to be able to handle a sudden power loss but this one so far has been different. debating how to handle. Other than a UPS, I am not sure how best to handle Nexcloud on the Pi.

I’ll continue to search around and see what I can find

Can confirm this exact same thing is happening to me, fresh imaged 1.52.2 and 1.52.1 on either a microsd card and USB flash drive. powers on get it all setup it reboots and then fails.

1 Like

You should consider the terms “microSD” or “USB flash drive” and “reliability” as antonyms, so If your data is worth anything to you, use an SSD, and of course, make regular backups of your data.

Also, @jtr is right, anything can happen with a sudden powerloss, especially when many data caches and a database are involved.

Correct all of my data is stored on an external SSD via USB the OS on the other hand is on the microSD card or the other USB drive, but are you saying that both the boot drives are simultaneously failing in the exact same way with repeatable steps?

Ok, I should have said, if the reliability of your system is worth anything to you, use an SSD. :wink:

I don’t use a Pi myself, but I know that there are ways to boot it directly from an SSD.

Not sure what happen there, but flash drives in general tend to fail suddenly. There is no grace period as with HDDs. However, the difference between SSDs and other types of flash storage like eMMC, SD-CARDs, and USB keys, performance aside, is that even cheap SSDs are designed for many more read and write cycles.

Wait my apologize bb77 it was something else but i appreciate your assistance, so steps i took as a possible repair were, fresh install 1.52.2, complete setup (rename pi user to another name and such) then after getting to web-gui and going to admin console side (:4443) and then updating to 1.52.4, then enabling ssh and going into pi via ssh, doing apt update && apt upgrade, then while in the admin console web page clear php cache and then reboot. was able to get back in.

What first happend w me was that I did the automatic updated and then reboot, this resulted in the 503 error.

What then fixed it for me was:

  1. opening the console (trough ssh or proxmox or however you installed it)
  2. sudo apt update
  3. sudo apt upgrade
  4. clearing the php cache trough the ncp config (open it using “ncp-config” and then tools)
  5. Sudo reboot

This fixed it for me, I did not have to reinstall like Bendingsyntax.

2 Likes

this saved me.

Thanks!