Repository navigation
503 Error after nextcloud runs a time #237
Description
Activity
- added0. Needs triagePending check for reproducibility or if it fits our roadmapPending check for reproducibility or if it fits our roadmap
on Jun 27, 2016 That's the second report I get of this but I still wasn't able to reproduce this locally on my instances. Then again, I only do use Apache. For other NGINX users it works fine though.
Is there any chance you can get me super easy reproduction steps (e.g. a docker container) or access to your machine using SSH (https://github.com/LukasReschke.keys)? That would make it way easier for me to debug this.
Hi, its me again, we talking together few days ago
Its pretty easy to reproduce.
If you want, I reproduce my config on a VPS, I will send you credentials.
edit : email sent
This is caused by a NGINX setting, the following is documented at https://docs.nextcloud.org/server/9/admin_manual/installation/nginx_owncloud_9x.html:
fastcgi_split_path_info ^(.+.php)(/.+)$;
This will fail hard, if somebody accesses
/directly withoutindex.phpin it then$_SERVER['SCRIPT_NAME']is set to an empty string instead ofindex.php. This can lead to any kind of problems and the NGINX config should probably be addressed for that.For now I'd just recommend to remove that line from your config.
@josh4trunks @mmattel Any idea how the NGINX config could be adjusted to keep this in mind?
Reacted by Arda KılıçdağıI´ve commented this line out, but have the same error. the owncloud client has a detailled error message: Internal Server error: The Request URI /remote.php/webdav/ did not end with the contents of PATH_INFO(i)
@LukasReschke
The line you reference doesn't affect "SCRIPT_NAME" passed to PHP, since that variable is set in fastcgi_params. But it does affect "SCRIPT_FILENAME"A request for "/" would be matched by the
/block, it does not match the PHP block with the line you reference.
It would then be rewritten to "/index.php" > then match the PHP block, which would set the "SCRIPT_FILENAME" to "/index.php"@benhartwich if you comment out that line, alot of aspects of owncloud won't work.
@LukasReschke I don't think you should tell people to remove that line =P
https://github.com/nextcloud/server/blob/stable9/lib/base.php#L518 calls IRequest::getScriptName(), this function reads $_SERVER['SCRIPT_NAME']. With the documented NGINX config SCRIPT_NAME is empty when opening / instead of /index.php. (just do a
var_dump($_SERVER);exit();in your index.php)Removing that line from the config sets the proper SCRIPT_NAME. I don't have much experience with NGINX but this seems just wrong. (expected behaviour would be to get "index.php")
@LukasReschke A request for "/" would not be passed to PHP. It would first be rewritten to "/index.php"
Please see #237 (comment)
@josh4trunks To illustrate the problem, I have created a docker. It is based on the config from https://docs.nextcloud.org/server/9/admin_manual/installation/nginx_examples.html (which is basically a 1:1 copy of the ownCloud docs page)
To test it please execute:
git clone https://gist.github.com/069d68d341254e265a143a9a3385c52c.git issue-237 cd issue-237/ docker build -t nextcloud . docker run -t -i nextcloud /bin/bashInside the container start PHP FPM and NGINX:
/etc/init.d/nginx start && /etc/init.d/php5-fpm startNow cURL
/index.phpand/directly:root@63c097aa0c98:/# curl http://localhost/ string(0) "" root@63c097aa0c98:/# curl http://localhost/index.php string(10) "/index.php"As you can see, the index.php is invoked in both but the proper SCRIPT_NAME is only set for the one where the index.php is appended. That's actually the problem that I'm pointing out here.
From a software perspective we do expect to get a proper
$_SERVER['SCRIPT_NAME']for the/URL as well.@LukasReschke Can you post/link to the exact nginx config and fastcgi_params so I can take a look.
If it is exactly as the docs, "/" would be internally rewritten to "/index.php" and SCRIPT_NAME would be "/index.php".Can you also try replacing the index.php with this to confirm SCRIPT_NAME is being set incorrectly.
<?php phpinfo(); ?>I can test this as well tonight. Currently running ownCloud but if you are correct this issue would crop up before touching the PHP code.
####EDIT####
Looking at your docker file, looks like you did what I'm thinking. Can you post your fastcgi_params13 remaining items
@josh4trunks Could we add this to the documentation? Or is this something special to the environment?
We should make this change. In default environments this is needed since we rely on rewrite now. It only doesn't affect some if they have something like fastcgi_index set to index.php, while this is common, it is not default.
Change is from...
include fastcgi_params; fastcgi_split_path_info ^(.+\.php)(/.+)$;to...
fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params;This needs to be applied to both
https://docs.nextcloud.org/server/9/admin_manual/installation/nginx_owncloud_9x.html#nextcloud-in-the-webroot-of-nginx
https://docs.nextcloud.org/server/9/admin_manual/installation/nginx_owncloud_9x.html#nextcloud-in-a-subdir-of-nginxReacted by Ivan Denkov- added a commit that references this issue
on Jul 1, 2016 @josh4trunks nextcloud/documentation#40 should do the trick then ;)
Reacted by Florian Schlegel@MorrisJobke Nop, its not right.
You forgot to remove
fastcgi_split_path_info ^(.+\.php)(/.+)$;and add instead
fastcgi_split_path_info ^(.+\.php)(/.*)$;@MorrisJobke Nop, its not right.
@aktavor69 Thanks a lot. I didn't spot that :( I fixed it :)
- added a commit that references this issue
on Jul 1, 2016 This should be fixed with the new Nginx config
I had the same issue after migrating from owncloud,
Simply switching the order of these two like this, as described above, fixed the problem for me:
fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params;I'm using Debian 8.6, PHP7.0, MariaDB, Nginx 1.10.1. All manual install.
Reacted by JulianHi,
I don't meant to re-open this thread, but the NC admin manual have incorrect order of those above two lines. The above solution is verified.
FYI: this error only occur on Android devices that use NextCloud app.Please update the admin manual.
Thanks.
Hi,
I don't meant to re-open this thread, but the NC admin manual have incorrect order of those above two lines. The above solution is verified.
FYI: this error only occur on Android devices that use NextCloud app.Please update the admin manual.
Our manual is also open source. 😉 Nevertheless I fixed it - see nextcloud/documentation#371
- added 2 commits that reference this issue
on Mar 8, 2017
Steps to reproduce
Actual behaviour
When I restart php5-fpm I can access nextcloud at chrome again. I´ve tested it with Firefox also and the same problem. It seems to be that only index.php is affected. When I run other URLs I can access nextcloud.
My php-fpm conf:
Server configuration
Operating system: Debian 8
Web server: nginx 1.11.1
Database: MariaDB
PHP version: 5.6.22
Nextcloud version: 9.0.5
Updated from an older Nextcloud/ownCloud or fresh install: new install
Where did you install Nextcloud from: nextcloud.com
Signing status (Nextcloud 9.0 and above):
List of activated apps:
The content of config/config.php:
Are you using external storage, if yes which one: local
Are you using encryption: no
Client configuration
Browser: Chrome
Operating system: Windows 7 64bit
Logs
Web server error log
Nextcloud log (data/owncloud.log)