Nextcloud behind Apache Proxy causing 404 error

Nextcloud version (eg, 18.0.4:
Operating system and version (eg, Ubuntu 20.04):
Apache or nginx version (eg, Apache 2.4.25):
PHP version (eg, 7.4:

The issue you are facing: When I access my nextcloud from my network using, it works fine. I reach a log-in page and can upload and download files . However I want to have it accessible from the internet, so have set up a domain, and forwarded the dns… This works fine.

I have an apache proxy setup, listening on 433 and proxying to the internal nc instance, when I try and access from the outside sustem I get a 404 error… I basically copied and pasted the file from another working proxy and tweaked the commands… The config.php might be a little more troublesome… I have read and attempted to tweak that with no success… I feel I am going in cirlcles, and am pretty sure that I am missing something glaringly obvious, but Google isnt my friend on this occasion
For clarity the proxy is, the server is and the url I am using to access from outside is
Thanks in advance

Is this the first time you’ve seen this error? N)_:

Steps to replicate it:

  1. Log in using

The output of your Nextcloud log in Admin > Logging:
Error PHP Use of undefined constant com’ - assumed ‘com’’ (this will throw an Error in a future version of PHP) at /var/www/nextcloud/config/config.php#25

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'ocp48lunrefv',
  'passwordsalt' => 'RWwdWhQQJnbNg1o1ohxbeJ51tWUlni',
  'secret' => 'wVBVHJISeuzEArP1g+6zHvPt4zW5XWP+5HHK8Oy6iEmfODEB',
'trusted_proxies' => array(''),
  'forwarded_for_headers' => array('HTTP_X_FORWARDED_FOR'),
  'trusted_domains' => 
  array (
    0 => '',
    1 => '',
    2 => '',
    3 => '',
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '',
   'overwrite.cli.url' => '/',
'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => ‘mypassword’,
  'installed' => true,

The output of your Apache/nginx/system log in /var/log/____:
Nothiing exciting
contents of file from etc/apache2/sites-available/

<VirtualHost *:443>
        SSLEngine On
        SSLProxyEngine On

SSLProtocol TLSv1.2
   SSLHonorCipherOrder On

   Include /etc/letsencrypt/options-ssl-apache.conf

                ProxyRequests Off
                ProxyPreserveHost Off

        ProxyPass /
      ProxyPassReverse /

        ProxyPassReverseCookiePath /nextcloud /nextcloud
      SSLCertificateFile /etc/letsencrypt/live/
        SSLCertificateKeyFile /etc/letsencrypt/live/

To whoever tidied up te format, Thank you very much… I guess that shows my noobness :slight_smile:

Problem solved, needed
‘overwrite.cli.url’ => ‘’,
‘overwriteprotocol’ => ‘https’,
‘overwritehost’ => ‘’,
adding to the config.php file

Thank you for this post, I was missing the overwritehost setting :slight_smile: