I have a nextcloud installation. Recently I moved it to a new server and put it behind a reverse proxy but now it is not working. It responds with an internal server error every time I try to login.
I will attach below my config.php, nextcloud logs, and both configurations for apache2.
Config.php
$CONFIG = array (
'instanceid' => 'Secret',
'passwordsalt' => 'Secret',
'secret' => 'Secret',
'trusted_domains' =>
array (
0 => 'nextcloud.domain.tld',
),
'overwritehost' => 'nextcloud.domain.tld',
'overwriteprotocol' => 'https',
'overwritewebroot' => '',
'overwrite.cli.url' => 'https://nextcloud.domain.tld/',
'trusted_proxies' =>
array (
0 => '192.168.1.6',
),
'datadirectory' => '/home/dal/nextcloud/data',
'dbtype' => 'mysql',
'version' => '27.0.0.8',
'dbname' => 'nextcloud',
'dbhost' => '192.168.1.6',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => 'Secret',
'installed' => true,
'defaultapp' => 'dashboard',
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_from_address' => 'Secret',
'mail_domain' => 'domain.tld',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtphost' => 'mail.domain.tld',
'mail_smtpport' => '465',
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
'app_install_overwrite' =>
array (
0 => 'files_videoplayer',
1 => 'video_converter',
2 => 'extract',
3 => 'pdfdraw',
4 => 'quickaccesssorting',
5 => 'checksum',
6 => 'cfg_share_links',
7 => 'ransomware_protection',
8 => 'registration',
9 => 'unsplash',
10 => 'audioplayer',
),
'simpleSignUpLink.shown' => false,
'updater.release.channel' => 'stable',
'mail_smtpauth' => 1,
'mail_smtpsecure' => 'ssl',
'mail_smtpname' => 'mail@domain.tld',
'mail_smtppassword' => 'Secret',
'default_phone_region' => 'US',
'htaccess.RewriteBase' => '/',
'redis' =>
array (
'host' => '127.0.0.1',
'port' => 6379,
),
'updater.secret' => 'Secret',
);
Nextcloud log
This a single entry from /data/nextcloud.log
The rest of the logs are just this but repeating
{
"reqId": "ItCILv4yllVGKRGfIRtE",
"level": 2,
"time": "2022-05-06T06:03:24+00:00",
"remoteAddr": "IP",
"user": "--",
"app": "no app in context",
"method": "POST",
"url": "/index.php/apps/index.php",
"message": "Could not detect any host in http:///data/htaccesstest.txt",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36",
"version": ""
}
Apache2 nextcloud config
<VirtualHost *:80>
ServerName 192.168.1.25
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud>
AllowOverride All
Require all granted
</Directory>
CustomLog /var/log/apache2/nextcloud.access.log common
ErrorLog /var/log/apache2/nextcloud.error.log
</VirtualHost>
Apache2 reverse proxy config
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName nextcloud.domain.tld
SSLCertificateFile /etc/letsencrypt/live/nextcloud.domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nextcloud.domain.tld/privkey.pem
#Include /etc/letsencrypt/options-ssl-apache.conf
ProxyPreserveHost On
ProxyRequests On
# allow for upgrading to websockets
RewriteEngine On
RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/remote.php/dav/ [R=301,L]
RequestHeader setifempty X-Forwarded-Proto https
# Proxy to your local mangonet instance
ProxyPass / http://192.168.1.25:80/
ProxyPassReverse / http://192.168.1.25:80/
</VirtualHost>
</IfModule>
The server running nextcloud is using Ubuntu 22.04.2 LTS with Apache/2.4.41
The server running the reverse proxy is using Ubuntu 20.04.06 LTS with Apache/2.4.52