You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Changing localhost to your TLD domain for use with nginx reverse proxy #846
I setup the latest nextcloud with docker-compose like the example shows. I also have nginx setup systemwide (not via docker) w/https via letsencrypt. I setup an A-record cloud.foo.com and setup the corresponding reverse proxy via nginx to point to localhost:8080.
This all seems to work fine for accessing via web, however the nextcloud instance still thinks it's domain / server name is 'localhost'. This is apparent by going to settings > Mobile & desktop where you see "server address: http://localhost:8080/". This also breaks functionality of all apps as when setup the server address as https://cloud.foo.com it loads a page asking to log in first or use an app token, both of which subsequently redirect to localhost:8080 which obviously are unreachable.
I am transitioning away from owncloud, and there they had a setting (OWNCLOUD_DOMAIN=cloud.foo.com) you added to your .env file that told OC what domain is should say it is. From what I've gathered I believe you can manually edit the config.php to set an "overwritehost" setting, though I'm not too sure how to do that with docker-compose. Any help would be greatly appreciated.
You'll notice the lines I've added from the example Nextcloud gives on their site is just a mapping to the config.php file. This makes it available on the local system for editing. The second link (commented out) is a special file nextcloud looks for to know if it can run the setup again. This is handy if you've already configured your system and don't want to purge everything and start over. Simply uncomment out that line and run: sudo docker-compose down && sudo docker-compose rm --force && sudo docker-compose pull && sudo docker-compose build --pull && sudo docker-compose up --force-recreate --build. You'll be asked to create an admin account and setup database connection info again. Once setup is complete the config.php will get re-written.
You'll now have to recomment out the "CAN_INSTALL" line and stop the docker container. Let's edit a few lines in the configuration file config.php.
Activity
jiveman commentedon Aug 28, 2019
I figured out my issue, leaving some bread crumbs in case someone else finds this thread.
First my docker-compose.yml
You'll notice the lines I've added from the example Nextcloud gives on their site is just a mapping to the config.php file. This makes it available on the local system for editing. The second link (commented out) is a special file nextcloud looks for to know if it can run the setup again. This is handy if you've already configured your system and don't want to purge everything and start over. Simply uncomment out that line and run:
sudo docker-compose down && sudo docker-compose rm --force && sudo docker-compose pull && sudo docker-compose build --pull && sudo docker-compose up --force-recreate --build. You'll be asked to create an admin account and setup database connection info again. Once setup is complete the config.php will get re-written.You'll now have to recomment out the "CAN_INSTALL" line and stop the docker container. Let's edit a few lines in the configuration file
config.php.This tells nextcloud your publicly accessible name is cloud.mytld.com or whatever you setup your domain to point to.
I hope this helps.
icasdri commentedon Sep 27, 2019
Related: #819
joshtrichards commentedon Oct 20, 2023
Fixed in #1048
Documented at https://github.com/nextcloud/docker#using-the-apache-image-behind-a-reverse-proxy-and-auto-configure-server-host-and-protocol