Nextcloud reverse proxy

I tried to follow:


and

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>
  ServerAdmin admin@domain.de
  ServerName cloud.domain.de
  DocumentRoot /var/www
  <Directory /var/www>
    Options +FollowSymlinks
    AllowOverride All
    <IfModule mod_dav.c>
      Dav off
    </IfModule>
    SetEnv HOME /var/www
    SetEnv HTTP_HOME /var/www
  </Directory>
  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"
  </IfModule>
  
  ProxyPass / http://localhost:40000/
  ProxyPassReverse / http://localhost:40000/

</VirtualHost>
</IfModule>

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' => 'https://cloud.domain.de',
  'overwritewbroot' => '/',
  'htaccess.RewriteBase' => '/', 
exit

I restarted apache

/etc/init.d/apache2 restart

And type cloud.domain.de
I get redirected to Nextcloud, but it displays an internal server error. I have no idea why.

cloud.domain.de/nextcloud/ works, just as from the beginning on.

What am I doing wrong?

That’s the error from NC:

{"reqId":"YjQY0D752nWmz7ZXujrB","level":3,"time":"2019-02-16T21:39:31+00:00","remoteAddr":"92.116.161.180","user":"--","app":"index","method":"GET","url":"\/login",
"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":"14.0.6.0"}

Hi,

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 cloud.domain.de/nextcloud into my browser, I get redirected to cloud.domain.de

Bernd

Hey,
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`

BR
fk

You can find the log files in
/var/lib/univention-appcenter/apps/nextcloud/data/nextcloud-data/nextcloud.log

@lebernd
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?

edit:
I think it’s strange that cloud.domain.de/nextcloud/login 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:

<?php
$CONFIG = array (
  'passwordsalt' => 'pwsaltxy',
  'secret' => 'secretxy',
  'trusted_domains' =>
  array (
    0 => 'myucs.intern.domain.de',
    1 => 'private IP',
    2 => 'public IP',
    3 => 'cloud.domain.de',
  ),
  'datadirectory' => '/var/lib/univention-appcenter/apps/nextcloud/data/nextcloud-data',
  'overwrite.cli.url' => 'https://cloud.domain.de',
  'dbtype' => 'pgsql',
  'version' => '14.0.6.0',
  '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: https://central.owncloud.org/t/the-requested-uri-login-cannot-be-processed-by-the-script-owncloud-index-php/993

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.