Support intro
Sorry to hear you’re facing problems
help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.
In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:
example
Or for longer, use three backticks above and below the code snippet:
longer
example
here
Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can
Nextcloud version (eg, 18.0.2): 19.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Don’t know it’s default Snap install
PHP version (eg, 7.1): Don’t know it’s default Snap install
The issue you are facing:
I installed it, configured it and it all worked fine under http.
I tested three means of access:
By LAN IP: http://192.168.0.14 - the IP the server is on.
By LAN DNS: http://nextcloud.lan - the name of the box with .lan names resolved locally
By WAN DNS: http://mynextcloud.mydomain.tld
All good.
I wanted to go https, so ran
sudo nextcloud.enable-https lets-encrypt
And tested:
http://192.168.0.14 - Works fine
http://nextcloud.lan - Works fine
http://mynextcloud.mydomain.tld - - Redirect loop.
I tested it with http://www.redirect-checker.org and see:
https://mynextcloud.mydomain.tld/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
https://mynextcloud.mydomain.tld:443/
301 Moved Permanently
Now the huge proble is diagnosing this! I’m not new to web stuff or Nextcloud but new to Snap and on the edge of tossing the Snap install, but for the fact that well, it seems to be vogue and upskilling here can’t go awry either. So far, pretty painful though.
How: Well I would check the the webserver logs and up webserver logging level to debug and log access requests etc and last I rememember on Apache (been a while to be honest dumped it for lighttpd most everywhere) I could ask it for rule resolution logging too. And if Apache wasn’t doing it I’d start logging PHP in debug.
But alas none of these configs are editable. The directory /snap/nextcloud
seems write protected in spite of ext4 permission saying I can write (and logging on as root even). Snap is pulling some trick new to me that the Linux kernel is respecting to keep the whole thing read only. /var/snap/nextcloud
is editable and has a famous config file here:
/var/snap/nextcloud/current/nextcloud/config/config.php
And it’s even documented to a good degree:
But the Apache and PHP configs at:
/snap/nextcoud/current/conf/httpd.conf
and
/snap/nextcloud/current/config/php/php.ini
are untouchable.
I can set Nextcloud logging to debug:
sudo snap set nextcloud mode=debug
sudo nextcloud.occ config:system:set loglevel --value=0
But see no clues when I inspect the log:
sudo nextcloud.occ log:watch
Nothing shows when I reload the WAN URL.
Now I am behind a reverse proxy. But it passes everything on that domain name unonditionally through to the Nextcloud box. I don’t expect this to make sense to anyone as it’s a lighttpd conf, as the reverse proxy is an OpenWRT gateway router and that runs lghttpd:
# The NextCloud server
$HTTP["host"] == "mynextcloud.mydomain.tld" {
proxy.server = ( "" => ( ( "host" => "192.168.0.14" ) ) )
}
But here’s the deal, because I can’t set Apache logging or PHP (frigging SNAP!) I can’t even see how the request is arriving at the Nextcloud server. If I could see that and know what host it sees, and further how it reacts to that host I’d be laughing.
To make matters worse, that reverse proxy untouched, as it stands, has been feeding a NextCloudPi server for years. NextCloudPi in fact rocks and I love it, but the Pi is a tad sluggish and unreliable (locks up and needs resets all too often so I’m moving to an Ubuntu server and Ubuntu 20.04 asks on install if you want a NextCloud server which is sweet, and it sintalls fine as a snap!)
Which evidences for me, that the proxy is probably, very probably, not the issue. That said, the NextCloudPi instance was still on Nextcloud 18 not 19 and it’s a different build and way more configurable than the Snap!
Even more painful is the sheer number of unrelated redirect loop question is in this forum, suggesting it’d be jolly nice if there was some quick way to diagnose the cause and that clearly demands detailed web request and response logging.
Now there may be a magic combo of settings here:
that fix this, and as much as I love, respect and cherish the documentation and effort that goes into it (I managed documentation teams for some while), this still does not serve well in clarifying what is going on here and what these settings actually do how and why.
Is this the first time you’ve seen this error? (Y/N): Y
Steps to replicate it: Well covered above.
The output of your Nextcloud log in Admin > Logging:
Well as stated nothing as added to the log in spit fo debug mode and debug log levels when I access through the WAN.
There are some issues in it but unrelated (I’d like to solve those but let’s not digress, they can wait). For the record here’s a tail 1000 of the log immediately after refreshing the WAN URL 3 or 4 times:
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
- Snap install and I don’t know what you mean here
The output of your Apache/nginx/system log in /var/log/____
:
- Snap install and Apache logs only errors and none are logged.
Given how often this crops up on the forum I can’t help but wonder if I missed or if there should be a FAQ page on redirect loops, likely causes, and diagnostic methods (that work for the Snap!)
I did find this:
but do I have to do this? And if so can I download a new snap while I keep my old snap disabled (but configured as I don’t want to lose the configs in /var/snap/nextcloud/current/nextcloud/config/config.php
at the very least. How much time and energy is snap going to sap from me in learning to work with it? I wonder.