[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 172.17.0.2. 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:
https://docs.nextcloud.com/server/15/admin_manual/configuration_server/config_sample_php_parameters.html#proxy-configurations
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:

2 Likes