0

I set up a fresh nextcloud installation, following the instructions here: https://hub.docker.com/_/nextcloud/, using the "Running this image with docker-compose" > "Base version - FPM" variant.

This resulted in three running docker containers:

IMAGE               COMMAND                  CREATED             STATUS              PORTS                  
nextcloud:fpm       "/entrypoint.sh php-…"   22 hours ago        Up 22 hours         9000/tcp               
mariadb             "docker-entrypoint.s…"   22 hours ago        Up 22 hours         3306/tcp               
nginx               "nginx -g 'daemon of…"   22 hours ago        Up 9 minutes        0.0.0.0:8080->80/tcp   

Everything fine so far.

But there is an existing apache installation, that needs to be used for incoming web traffic. Inside a new vhost, I set up the following proxy directives to redirect the appropriate requests to the nginx docker:

ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/

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]

RewriteRule ^/ - [QSA,L]

The installation seems to work now via webinterface without problems.

But a) there is a warning that the reverse proxy header configuration is not correct. I am not sure, if this is a severe issue, as it talks about being ok if there is a trustworthy proxy, but I am not sure (message is in german).

And b) the server url is not correct. Mobile devices seem to need this to connect. It reports the internal nginx url http://127.0.0.1:8080/ instead of the public name https://cloud.somedomain.com.

This is logical, as the nextcloud/docker process didn't knew anything of apache and the external name, but I don't know where to specify it.

I tried this https://github.com/nextcloud/docker/pull/527#issuecomment-434492082, but it didn't worked.

I read about environment variables DEFAULT_HOST and VIRTUAL_HOST here https://github.com/jwilder/nginx-proxy and NEXTCLOUD_TRUSTED_DOMAINS here https://hub.docker.com/_/nextcloud/, but I am not sure how to apply them and whether this would be the correct approach.

1

I found the solution, just after having posted this question... -.-

The following parameters need to be added to the /var/www/html/config/config.php file in the nextcloud docker, to set the correct url:

'overwritehost' => 'cloud.somedomain.com',
'overwriteprotocol' => 'https',

This is described here: https://docs.nextcloud.com/server/16/admin_manual/configuration_server/reverse_proxy_configuration.html#overwrite-parameters

From what the description implies, this may have been possible to being autodetected. But apparently, it didn't worked for me.

Now the server url is reported correctly in the admin web UI and login of mobile devices are working!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.