No css or js delivery via index.php?

I’m trying to use Nextcloud with php-fpm on one host, served by nginx on another host. There’s no files on the nginx host – by design. All files should be provided by the php-fpm host.

All example configurations use a try_files statement for static assets (css, js, png, etc.) so it seems this should be possible. If there are no static files for nginx (i.e. no matching $uri while “try_files”) then the following try_files statement:

try_files $uri /nextcloud/index.php$request_uri;

… will result in something like:

https://www.my.domain/nextcloud/index.php/nextcloud/core/js/installation.js

which will get forwarded to the php-fpm service. That makes sense only if index.php is indeed able to deliver such files and is indeed a common concept widely adopted.

But I cannot convince nextclouds index.php to serve those files.

For example (depends on exact configuration) with fastcgi params like:


‘PATH_INFO’ => ‘/nextcloud/core/js/installation.js’,
‘SCRIPT_FILENAME’ => ‘/srv/nextcloud/index.php’,
‘DOCUMENT_ROOT’ => ‘/srv’,
‘SCRIPT_NAME’ => ‘/nextcloud/index.php’,

it should serve /srv/nextcloud/core/js/installation.js which actually is ready to be served …

But even if I experiment with the PATH_INFO variable (with or without “nextcloud” in it, with or without full paths, other DOCUMENT_ROOTs, etc.), no matter what I do (this example is only one of the thousands I tried), index.php refuses to deliver any css or js. It’s always some nextcloud html with Content-Type: text/html.

Am I doing something wrong with my php-fpm configuration or is the “try_files” misleading and nextclouds index.php is indeed NOT able to deliver any of its js/css files at all!?

1 Like