Fcgi connect timeout

I was just updating a nextcloud instance, and it refused to complete the process. The error from cloudflare was a monstrous flurry of json, but in the apache error logs I found.
[proxy_fcgi:error] [pid 794701:tid 140501600630528] (70007)The timeout specified has expired: [client] AH01075: Error dispatching request to : (polling)

So after searching around a bit I found the solution to altering it server-wide, was to edit /etc/apache2/mods-enabled/fcgi.conf and increase the fcgi connect timeout from 20 seconds to 120:

FcgidConnectTimeout 120

So that allowed the update to proceed. I was wondering, if I wanted to do this on a per-site basis, rather than a server-wide basis, where I’d set this. Didn’t look like it would be possible in the php-fpm files, so maybe in the apache config somewere? /home/user/conf/domain/ or .htaccess, or .user.ini ??

if you check here: https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidconnecttimeout
for the context in which this directive is available, you’ll find it be possible within vhost context too.

so you could create a custom apache conf file for your domain in the folder /home/<user>/conf/<yourdomain>/ with that line in it, so it will be included. name for custom configs should be apache2.conf_something and apache2.ssl.conf_something

Aha, good information, so if its in an “_something” file then its still within the Virtual host context. That was the key bit of info.
And, yes I see from the apache.org site now, that .htaccess and .user.ini aren’t where to put this. Thanks! Guess I was a bit lazy on my research, but I also wanted to put it out there in the forum, so others could benefit.

1 Like

just to avoid confusion: the “_something” is not to be taken literally :wink:

if you look at the default conf files (which you don’t want to edit, because they might get overwritten on a domain or user rebuild) you can find the includeoptional with a wildcard for raking in your custom files:

IncludeOptional /home/testuser/conf/web/example.org/apache2.conf_*

so obviously _anything _custom _should _do _the _trick :joy:


  1. Try to upgrade Nextcloud / OwnCloud from CLI
    it is much more straightforward, faster, failproof, and does not rely on timeouts and other http/s specific limits.

ref : https://docs.nextcloud.com/server/latest/admin_manual/maintenance/manual_upgrade.html

  1. Use Custom templates with specific parameters optimised for Apache / Nginx as given in Nextcloud docs


Yes, I’ve used them before for adding security tweaks to various websites. But I kinda like the idea of a _something file, or _whatever.

Thanks mehargags. I have done the manual upgrade before, in fact it used to be the only way to upgrade back in the owncloud days, but I don’t really see that a 15 step manual process is either more straightforward, or faster than just mashing the upgrade button! :slight_smile: I’m just lazy like that. The server is a small one, and only me using it, with a tiny bit of data, so no problem.
In fact the timeout info will be useful for the future too. For example sometimes when you install the demo data in a Wordpress theme, it can take 5,10 minutes to download it all.