Stuck on installation: proxy_fcgi AH01071 error

Nextcloud version: 22.1.1
Operating system and version: Ubuntu 16.04
Apache version: Apache2
PHP version: 7.3

The issue you are facing:

When I install Nextcloud, everything seems to go fine until it begins the installation. Then, it tries to redirect me to this url:

https://index.php/core/apps/recommended

Which is obviously wrong and goes nowhere. When I try to just go to the Nextcloud location, I get a branded, Nextcloud internal service error.

In the logs, it says proxy_fcgi:error AH01071 ‘primary script unknown’.

Is this the first time you’ve seen this error? Yes.

The output of your Nextcloud log in Admin > Logging:

I can't seem to get the log to populate again right now, I don't know why. But I posted the relevant error

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'i.website.org',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.1.1.2',
  'overwrite.cli.url' => 'https://i.website.org',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

[Sat Sep 04 20:45:05.457915 2021] [:notice] [pid 4242] FastCGI: process manager initialized (pid 4242)
[Sat Sep 04 20:45:05.483937 2021] [mpm_prefork:notice] [pid 4241] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 20:45:05.483987 2021] [core:notice] [pid 4241] AH00094: Command line: '/usr/sbin/apache2'
[Sat Sep 04 20:45:21.503981 2021] [mpm_prefork:notice] [pid 4241] AH00169: caught SIGTERM, shutting down
[Sat Sep 04 20:45:21.573485 2021] [:notice] [pid 4304] FastCGI: process manager initialized (pid 4304)
[Sat Sep 04 20:45:21.601508 2021] [mpm_prefork:notice] [pid 4303] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 20:45:21.601555 2021] [core:notice] [pid 4303] AH00094: Command line: '/usr/sbin/apache2'
[Sat Sep 04 20:49:16.064615 2021] [mpm_prefork:notice] [pid 4303] AH00169: caught SIGTERM, shutting down
[Sat Sep 04 20:49:16.143467 2021] [:notice] [pid 5244] FastCGI: process manager initialized (pid 5244)
[Sat Sep 04 20:49:16.207725 2021] [mpm_prefork:notice] [pid 5243] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 20:49:16.207792 2021] [core:notice] [pid 5243] AH00094: Command line: '/usr/sbin/apache2'
[Sat Sep 04 20:51:28.157220 2021] [mpm_prefork:notice] [pid 5243] AH00169: caught SIGTERM, shutting down
[Sat Sep 04 20:51:28.224350 2021] [:notice] [pid 5680] FastCGI: process manager initialized (pid 5680)
[Sat Sep 04 20:51:28.259792 2021] [mpm_prefork:notice] [pid 5679] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 20:51:28.259844 2021] [core:notice] [pid 5679] AH00094: Command line: '/usr/sbin/apache2'
[Sat Sep 04 20:52:53.054662 2021] [mpm_prefork:notice] [pid 5679] AH00169: caught SIGTERM, shutting down
[Sat Sep 04 20:52:53.151404 2021] [:notice] [pid 5923] FastCGI: process manager initialized (pid 5923)
[Sat Sep 04 20:52:53.167698 2021] [mpm_prefork:notice] [pid 5922] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 20:52:53.167781 2021] [core:notice] [pid 5922] AH00094: Command line: '/usr/sbin/apache2'
[Sat Sep 04 21:11:30.326888 2021] [mpm_prefork:notice] [pid 5922] AH00169: caught SIGTERM, shutting down
[Sat Sep 04 21:11:30.405856 2021] [:notice] [pid 7847] FastCGI: process manager initialized (pid 7847)
[Sat Sep 04 21:11:30.433916 2021] [mpm_prefork:notice] [pid 7846] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 21:11:30.433958 2021] [core:notice] [pid 7846] AH00094: Command line: '/usr/sbin/apache2'
[Sat Sep 04 21:24:16.870391 2021] [mpm_prefork:notice] [pid 7846] AH00169: caught SIGTERM, shutting down
[Sat Sep 04 21:24:16.941012 2021] [:notice] [pid 9047] FastCGI: process manager initialized (pid 9047)
[Sat Sep 04 21:24:17.114361 2021] [mpm_prefork:notice] [pid 9046] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 21:24:17.114421 2021] [core:notice] [pid 9046] AH00094: Command line: '/usr/sbin/apache2'
[Sat Sep 04 21:25:59.643603 2021] [mpm_prefork:notice] [pid 9046] AH00169: caught SIGTERM, shutting down
[Sat Sep 04 21:25:59.709988 2021] [:notice] [pid 9245] FastCGI: process manager initialized (pid 9245)
[Sat Sep 04 21:25:59.736998 2021] [mpm_prefork:notice] [pid 9244] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 21:25:59.737047 2021] [core:notice] [pid 9244] AH00094: Command line: '/usr/sbin/apache2'
[Sat Sep 04 21:39:40.636917 2021] [mpm_prefork:notice] [pid 9244] AH00169: caught SIGTERM, shutting down
[Sat Sep 04 21:41:22.731632 2021] [:notice] [pid 10906] FastCGI: process manager initialized (pid 10906)
[Sat Sep 04 21:41:22.758670 2021] [mpm_prefork:notice] [pid 10905] AH00163: Apache/2.4.46 (Ubuntu) mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1g configured -- resuming normal operations
[Sat Sep 04 21:41:22.758710 2021] [core:notice] [pid 10905] AH00094: Command line: '/usr/sbin/apache2'

Sorry, there must have been specs somewhere that outlined this, and I just didn’t look hard enough. You must have MySQL 8 for the newest version of NextCloud, and I was way back on 5. So I upgraded, and then I ran this:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Added this line:

sort_buffer_size = 256000000

And then restarted:

sudo service mysql restart

And now I’m good. I was looking in the wrong log, too. The correct error messages were in /data/nextcloud.log.