Hallo everybody please I need help on following probelme:
I have a revers proxy server (apache2)
and a virtual machine running Nextcloud on a server in the same network as the proxy.
Everything is working as it should be except for one thing:
When trying to reache https://mydomain.com/cloud it overwrites the URL to https://mydomain.com/index.php - no site was loaded, but when entering https://mydomain.com/cloud/ - everything works fine (okay the login is a bit wonky but I expect that is related to the problem)
Needt help plz!!!
here is my revers proxy site (redacted):
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName mydomain.com
ServerAdmin office@mydomain.com
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552010; includeSubDomains"
</IfModule>
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/\.well-known/carddav https://%{SERVER_NAME}/cloud/remote.php/dav/ [R=301,L]
RewriteRule ^/\.well-known/caldav https://%{SERVER_NAME}/cloud/remote.php/dav/ [R=301,L]
ProxyPass /cloud "http://xxx.xxx.xxx.xxx"
ProxyPassReverse /cloud "http://xxx.xxx.xxx.xxx"
ProxyPassReverseCookiePath /cloud /cloud
ErrorLog ${APACHE_LOG_DIR}/proxy.log
CustomLog ${APACHE_LOG_DIR}/proxy.log combined
SSLCertificateFile /etc/letsencrypt/live/mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
NC apache2 site:
ServerName mydomain/cloud
ServerAdmin office@mydomain.com
DocumentRoot /var/www/html/nextcloud
here NC config.php (redacted):
<?php
$CONFIG = array (
'instanceid' => 'xxxxxxxxxxxxxxxxxxxxx',
'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxxxxxxxxxxxxx',
'trusted_proxies' =>
array (
0 => 'xxx.xxx.xxx.xxx',
),
'overwritehost' => 'mydomain.com',
'overwriteprotocol' => 'https',
'overwritecondaddr' => '^xxx\\.xxx\\.xxx\\.xxx$',
'overwritewebroot' => '/cloud',
'trusted_domains' =>
array (
0 => 'mydomain.com',
1 => 'xxx.xxx.xxx.xxx',
2 => 'xxx.xxx.xxx.xxx',
3 => 'xxx.xxx.xxx.xxx',
'datadirectory' => '/var/www/html/nextcloud',
'dbtype' => 'mysql',
'version' => '18.0.0.10',
'overwrite.cli.url' => 'mydomain.com/cloud',
'dbname' => 'mydbnc',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'myuser',
'dbpassword' => 'mypaswd',
'activity_expire_days' => 14,
'auth.bruteforce.protection.enabled' => true,
'blacklisted_files' =>
array (
0 => '.htaccess',
1 => 'Thumbs.db',
2 => 'thumbs.db',
),
'cron_log' => true,
'enable_previews' => true,
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\PNG',
1 => 'OC\\Preview\\JPEG',
2 => 'OC\\Preview\\GIF',
3 => 'OC\\Preview\\BMP',
4 => 'OC\\Preview\\XBitmap',
5 => 'OC\\Preview\\Movie',
6 => 'OC\\Preview\\PDF',
7 => 'OC\\Preview\\MP3',
8 => 'OC\\Preview\\TXT',
9 => 'OC\\Preview\\MarkDown',
),
'filesystem_check_changes' => 0,
'filelocking.enabled' => 'true',
'htaccess.RewriteBase' => '/',
'integrity.check.disabled' => false,
'knowledgebaseenabled' => false,
'logfile' => '/var/log/nextcloud.log',
'loglevel' => 0,
'logtimezone' => 'XXXXXXXXXXX',
'log_rotate_size' => 104857600,
'maintenance' => false,
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'preview_max_x' => 1024,
'preview_max_y' => 768,
'preview_max_scale_factor' => 1,
'redis' =>
array (
'host' => '/var/run/redis/redis-server.sock',
'port' => 0,
'timeout' => 0.0,
),
'quota_include_external_storage' => false,
'share_folder' => '/Shares',
'skeletondirectory' => '',
'theme' => '',
'trashbin_retention_obligation' => 'auto, 7',
'updater.release.channel' => 'stable',
'installed' => true,
'data-fingerprint' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'onlyoffice' =>
array (
'verify_peer_off' => TRUE,
),
);
and nextcloud .htacces (only what I added):
<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|svg|gif|png|html|ttf|woff2?|ico|jpg|jpeg)$
RewriteCond %{REQUEST_FILENAME} !core/img/favicon.ico$
RewriteCond %{REQUEST_FILENAME} !core/img/manifest.json$
RewriteCond %{REQUEST_FILENAME} !/remote.php
RewriteCond %{REQUEST_FILENAME} !/public.php
RewriteCond %{REQUEST_FILENAME} !/cron.php
RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php
RewriteCond %{REQUEST_FILENAME} !/status.php
RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php
RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php
RewriteCond %{REQUEST_FILENAME} !/robots.txt
RewriteCond %{REQUEST_FILENAME} !/updater/
RewriteCond %{REQUEST_FILENAME} !/ocs-provider/
RewriteCond %{REQUEST_URI} !^/\.well-known/(acme-challenge|pki-validation)/.*
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>
Nextcloud version: 18.0.0.10_
Operating system and version: Ubuntu 18.04
Apache or nginx version: Apache 2.4.25
PHP version: 7.3-fpm