[SOLVED] Nextcloud container behind Nginx: Redirected to localhost

Hi everyone!
I’m currently using the apache image for Nextcloud.
I have a non-dockerized nginx in front, with the following configuration:

server {
listen 443 ssl;
server_name cloud.mydomain.com;

    location / {
            proxy_pass http://localhost:8888;
    include /etc/nginx/conf.d/letsencrypt.location;


In some situations, like for example, when trying to log out, the url is: http://localhost:8888/logout?requesttoken=some_token_here
So instead of building the url to the domain name, it goes to localhost.
I’ve seen in the logs when firing up the container:

AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using Set the ‘ServerName’ directive globally to suppress this message

Is that related? Is the solution telling Apache which should be the domain instead of localhost?
If so, how can I do it with the apache image for docker?

Thank you very much in advance, let me know if there is any more information I should provide!

There are some configuration options regarding reverse proxy scenarios:
Are those set in Nextclouds config.php file?

I don’t think the apache error message has something to do with it. Googling the error message brings this up:

I can’t tell you which file to edit in the apache image though…

Hey Bernie!

overwritehost and overwriteprotocol worked like a charm! I have the config in a volume, so I could change it easily.

You have been of a lot of help here! I really appreciate it, thank you very much :trophy: