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.
The Basics
- Nextcloud Server version : 30.0.5
- Operating system and version :
- Ubuntu 24.04
- Web server and version
- Apache 2.4.58
- Reverse proxy and version
-NGINX Proxy Manager - PHP version :
- 8.3
- Is this the first time you’ve seen this error?:
- Yes :
- When did this problem seem to first start?
- When i needed NGINX Proxy Manager.
- Installation method :
- Bare Metal
- Are you using CloudfIare, mod_security:
- Cloudflace - Proxy OFF
Locally the website works https://nc.mydomain.eu
It also works over VPN Wireguard which is installed on the same machine.
Another machine runs Nginx Proxy manager. NPM is on 192.168.1.5
A proxy rule was made to nc.mydomain.eu with SSL/HTTP-2/HSTS/HSTS subdomains. :80(also tried :443)
Other things work fine so i know NPM is working for example ‘minecraft.mydomain.eu’ opens the management interface.
When i use my phone (Wifi/vpn off) Chrome/Chrome beta/Brave/Opera i get ‘ERR_TOO_MANY_REDIRECTS’
.htaccess is setup and used to work before NPM was installed, when i forward the ports back to Apache2/nextcloud it works again.
I checked SSL logs on apache2 and on NPM. There isn’t much there
Most searches for ‘.htaccess’ configuration ended up with nothing working at all and were related to WP.
I check with : https://httpstatus.io/
If any more logs are needed please let me know.
Apache2 error.log (this apparently should be normal?) :
[Sat Jan 25 00:00:01.646000 2025] [core:notice] [pid 309543:tid 123292967192448] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jan 25 16:59:56.058343 2025] [access_compat:error] [pid 321738:tid 123292604171968] [client ::1:45804] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ncdata
[Sat Jan 25 16:59:56.409188 2025] [access_compat:error] [pid 321737:tid 123292237170368] [client 127.0.0.1:55506] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ncdata
[Sat Jan 25 16:59:56.540040 2025] [access_compat:error] [pid 321738:tid 123292448982720] [client 192.168.1.2:32800] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ncdata
These are all the things i tried.
Tried in nextcloud config.php:
<?php
$CONFIG = array (
'trusted_proxies' => ['192.168.1.5'],
'overwritehost' => 'nc.mydomain.eu',
'overwriteprotocol' => 'https',
'overwritewebroot' => '/nextcloud',
'overwritecondaddr' => '^192\.168\.1\.5$',
'overwrite.cli.url' => 'https://nc.mydomain.eu/,
);
Tried changing /var/www/nextcloud/.htaccess
RewriteEngine on
rewritecond %{http_host} ^mydomain.eu [nc]
rewriterule ^(.*)$ http://nc.mydomain.eu/$1 [r=301,nc]
I’m not sure if that’s correct at all since it’s https.
Same for this:
#301 redirect
RewriteCond %{HTTP_HOST} ^nc.mydomain.eu$ [NC]
RewriteRule ^(.*)$ http://nc.mydomain.eu/$1 [R=301,L]
#https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#remove home
RewriteCond %{THE_REQUEST} ^.*/home
RewriteRule ^(.*)home$ https://nc.mydomain/$1 [R=301,L]
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://nc.mydomain.eu/
# then use
# RewriteBase /
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Also tried :
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule - https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L,R=301]
I don’t know what else to do really hoping someone has the answer.
This is my .htaccess bottom part.
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####
ErrorDocument 403 //index.php/error/403
ErrorDocument 404 //index.php/error/404
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]
RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]
RewriteCond % REQUEST_FILENAME}!\.css|js|mjs|svg|gif|ico|jpg|jpeg|png|webp|html|otf|ttf|woff2?|map|webm|mp4|mp3|ogg>
RewriteCond %{REQUEST_FILENAME} !/core/ajax/update\.php
RewriteCond %{REQUEST_FILENAME} !/core/img/(favicon\.ico|manifest\.json)$
RewriteCond %{REQUEST_FILENAME} !/(cron|public|remote|status)\.php
RewriteCond %{REQUEST_FILENAME} !/ocs/v(1|2)\.php
RewriteCond %{REQUEST_FILENAME} !/robots\.txt
RewriteCond %{REQUEST_FILENAME} !/(ocs-provider|updater)/
RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
RewriteCond %{REQUEST_FILENAME} !/richdocumentscode(_arm64)?/proxy.php$
RewriteRule . index.php [PT,E=PATH_INFO:$1]
RewriteBase /
<IfModule mod_env.c>
SetEnv front_controller_active true
<IfModule mod_dir.c>
DirectorySlash off
</IfModule>
</IfModule>
</IfModule>
Here’s my Nextcloud-le-ssl.conf (changed URLS)
<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot /var/www/nextcloud/
ServerName nc.mydomain.eu
<Directory /var/www/nextcloud/>
Satisfy Any
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
# Encoded slashes need to be allowed
#AllowEncodedSlashes NoDecode
# Container uses a unique non-signed certificate
#SSLProxyEngine On
#SSLProxyVerify None
#SSLProxyCheckPeerCN Off
#SSLProxyCheckPeerName Off
# keep the host
#ProxyPreserveHost On
# static html, js, images, etc. served from coolwsd
# browser is the client part of LibreOffice Online
#ProxyPass /browser https://127.0.0.1:9980/browser retry=0
#ProxyPassReverse /browser https://127.0.0.1:9980/browser
# WOPI discovery URL
#ProxyPass /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
#ProxyPassReverse /hosting/discovery https://127.0.0.1:9980/hosting/discovery
# Main websocket
#ProxyPassMatch "/cool/(.*)/ws$" wss://127.0.0.1:9980/cool/$1/ws nocanon
# Admin Console websocket
#ProxyPass /cool/adminws wss://127.0.0.1:9980/cool/adminws
# Download as, Fullscreen presentation and Image upload operations
#ProxyPass /cool https://127.0.0.1:9980/cool
#ProxyPassReverse /cool https://127.0.0.1:9980/cool
# Endpoint with information about availability of various features
#ProxyPass /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities retry=0
#ProxyPassReverse /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities
<IfModule mod_dav.c>
Dav off
</IfModule>
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
</IfModule>
</Directory>
SSLCertificateFile /etc/letsencrypt/live/nc.mydomain.eu/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nc.mydomain.eu/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
If someone manages to read all the way to here, thank you very much.
I got really frustrated trying to just ask a question here.