NextCloud PHP errors

After updating NextCloud to 10.0.2 I was getting a ton of errors in my log files and the NextCloud desktop client wouldn’t sync;

[Tue Dec 27 15:47:11.548182 2016] [proxy_fcgi:error] [pid 20114] [client <IP address>:58648] Invalid status line from script ‘<filename>.jpg': 0

I had this with 10.0.1 but I just ignored it and reverted to 10.0.0 as I didn’t have time to look in to it.

With the Christmas break I was able to and 5 minutes later I found this;
https://help.nextcloud.com/t/unable-to-access-directories-starting-with-a-hash-sign/6308/4

The issue appears to be down to the way that PHP-FPM was being accessed by Apache.

I was using something similar to;

ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:$port/var/www/owncloud/\

Changing it to the following enabled NextCloud to work fine (again)

<FilesMatch \.php$>
  SetHandler "proxy:fcgi://127.0.0.1:$port"
</FilesMatch>

I’m assuming something changed in the code which impacted the above as none PHP files are accessed through a PHP script but I’m just glad its working again.