-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
503 Error after nextcloud runs a time #237
Comments
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:
This will fail hard, if somebody accesses 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? |
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 A request for "/" would be matched by the |
@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 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:
Inside the container start PHP FPM and NGINX:
Now cURL
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 |
@LukasReschke Can you post/link to the exact nginx config and fastcgi_params so I can take a look. Can you also try replacing the index.php with this to confirm SCRIPT_NAME is being set incorrectly.
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#### |
You can find the NGINX config file at https://gist.github.com/069d68d341254e265a143a9a3385c52c, the fastcgi_params are the defaults from Debian and can be found at https://gist.github.com/LukasReschke/65c3cb807e5e4be8a21dcfd26d19d6de. This is a new Docker container that can be easily setup locally by performing the steps from #237 (comment) :)
Output of http://localhost/ is at https://rawgit.com/LukasReschke/1937e99d78a85216f917c9b769215ce4/raw/9d512fc9bfac73a9400e1d5900945d72d4590ee3/gistfile1.html Output of http://localhost/index.php is at https://rawgit.com/LukasReschke/c386766a72a37aa0ce2dfb889beaed42/raw/80534db1501abcb3676ed539df79286b3e513bca/phpinfo.html You also see that |
Ok, I think I see what if going on, but I don't understand why, and I can't reproduce with my FreeBSD system. It looks like a bug with nginx in this case. $fastcgi_script_name is being unset during nginx's rewrite. |
Even in the case of /index.php $SERVER_NAME is blank. Can you confirm fastcgi_params is being included? Maybe hardcode SERVER_NAME to something and make sure it does show. Ohh, and no docker for me. No access to my linux desktop at the moment, only my freebsd servers. |
It is. If I change it in the fastcgi_params file to |
@LukasReschke if you need, you can send ssh axx from my test server to @josh4trunks |
ok, I think this is a bug with the nginx being used. My nginx changes the value of $fastcgi_params after the rewrite, while this build look like it is unsetting or not changing it. |
|
I can't SSH at the moment. Could debug more deeply tonight. Here's a test..
test.php
|
I'm using version 1.8. I can update to 1.10 and see if I can reproduce this behavior. But the workaround of switching the order of the two lines is probable safest to solve this in all cases. |
I think I have been misunderstanding this. My suggestion is we move switch the order like so
EDIT Please see this #237 (comment) |
Same issue with this order |
Hmm, I guess we should split regarless of if an actual file is being requested.
|
Seems working :D |
@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...
to...
This needs to be applied to both |
@josh4trunks nextcloud/documentation#40 should do the trick then ;) |
@MorrisJobke Nop, its not right. You forgot to remove
and add instead
|
@aktavor69 Thanks a lot. I didn't spot that :( I fixed it :) |
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:
I'm using Debian 8.6, PHP7.0, MariaDB, Nginx 1.10.1. All manual install. |
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. Please update the admin manual. Thanks. |
* see nextcloud/server#237 (comment) Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Our manual is also open source. 😉 Nevertheless I fixed it - see nextcloud/documentation#371 |
* see nextcloud/server#237 (comment) Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* see nextcloud/server#237 (comment) Signed-off-by: Morris Jobke <hey@morrisjobke.de>
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)
The text was updated successfully, but these errors were encountered: