Nextcloud reverse proxy

I tried to follow:


whereas I wasn’t able to get it working with the template file.

So I created /etc/apache2/sites-enabled/nextcloud.conf and pasted following in it:

<IfModule mod_ssl.c>
<VirtualHost *:443>
  DocumentRoot /var/www
  <Directory /var/www>
    Options +FollowSymlinks
    AllowOverride All
    <IfModule mod_dav.c>
      Dav off
    SetEnv HOME /var/www
    SetEnv HTTP_HOME /var/www
  SSLEngine on
  SSLProxyEngine on
  SSLProxyCheckPeerCN off
  SSLProxyCheckPeerName off
  SSLCertificateFile /etc/univention/letsencrypt/signed_chain.crt
  SSLCertificateKeyFile /etc/univention/letsencrypt/domain.key
  SSLCACertificateFile /etc/univention/ssl/ucsCA/CAcert.pem
  SSLCertificateChainFile /etc/univention/letsencrypt/intermediate.pem

  <IfModule mod_headers.c>
   Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
  ProxyPass / http://localhost:40000/
  ProxyPassReverse / http://localhost:40000/


I also modified the config file by

univention-app shell nextcloud
apt update
apt install vim
vim  /var/www/html/config/config.php
  'overwrite.cli.url' => '',
  'overwritewbroot' => '/',
  'htaccess.RewriteBase' => '/', 

I restarted apache

/etc/init.d/apache2 restart

And type
I get redirected to Nextcloud, but it displays an internal server error. I have no idea why. works, just as from the beginning on.

What am I doing wrong?

That’s the error from NC:

"message":{"Exception":"Exception","Message":"The requested uri(\/login) cannot be processed by the script '\/nextcloud\/index.php')","Code":0,"Trace":[{"file":"\/var\/www\/html\/lib\/base.php","line":930,"function":"getRawPathInfo","class":"OC\\AppFramework\\Http\\Request","type":"->","args":[]},{"file":"\/var\/www\/html\/index.php","line":42,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"\/var\/www\/html\/lib\/private\/AppFramework\/Http\/Request.php","Line":742,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/70.0.3538.102 Safari\/537.36 OPR\/57.0.3098.116","version":""}


I didn’t find your error in the files. The only difference I see is the missing retry 0 in the ProxyPass - but I don’t see how this would make such an error. So I ask stupid questions, like:

  • did you restart apache inside the docker-image too?

(don’t forget to edit /var/lib/univention-appcenter/apps/nextcloud/data/integration/config/config.php and chown it correctly: chown www-data:nogroup ... like this you don’t have to redo everything with the next docker update)

I ask the question because, when I type into my browser, I get redirected to


I have exactly the same problem! I have done a new installation an the strange behaviour remains. I followed exactly the way described here.

Where do I find the nextcloud logs`


You can find the log files in

Thank you for your reply, but the missing retry 0 didn’t fix the problem.
I restartet the docker

service docker-app-nextcloud stop
service docker-app-nextcloud start

or the server, nothing helped.

I must miss something, but I don’t know what.

It was a fresh install in my case, too. Maybe there has been something changed in the docke images?

I think it’s strange that still works, even though I modified the config.php file in the docker image, which, as far as I understand, should make this impossible.

Can you post your config.php? are there other/ conflicting rewrite parameters?

Mine looks like this:

$CONFIG = array (
  'passwordsalt' => 'pwsaltxy',
  'secret' => 'secretxy',
  'trusted_domains' =>
  array (
    0 => '',
    1 => 'private IP',
    2 => 'public IP',
    3 => '',
  'datadirectory' => '/var/lib/univention-appcenter/apps/nextcloud/data/nextcloud-data',
  'overwrite.cli.url' => '',
  'dbtype' => 'pgsql',
  'version' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'docker gw IP',
  'dbport' => '5432',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'dbpass',
  'installed' => true,
  'instanceid' => 'occ010101',
  'updatechecker' => 'false',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'overwriteprotocol' => 'https',
  'overwritewbroot' => '/',
  'htaccess.RewriteBase' => '/',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'trusted_proxies' =>
  array (
    0 => 'docker gw IP',
  'loglevel' => 2,
  'maintenance' => false,

Google is pointing for a similar error to:

1 Like

the following did the trick for me (thanks @lebernd for pointing to the link) :

dial in the nextcloud containter:

univention-app shell nextcloud

go to /var/www/html and

sudo -u www-data php occ maintenance:update:htaccess

it should give you

.htaccess has been updated
1 Like

Thank you both for your help.
The solution from fk22 did the trick for me, too. Now it works. Thank you again.