Nginx-proxy: Howto server multiple Sites on one host? (Nextcloud in subdirectory)
At https://github.com/nextcloud/docker/tree/master/.examples#with-nginx-proxy it is written "The proxy is designed to serve multiple sites on the same host machine." Thats fine - but: could somebody pls. explain how and document it there?
What should be explained:
- Where to set which settings to get Nextcloud running in some subdirectory (e.g. "/nextcloud" on the server) for that proxy- setup? (As far as i have understood, with the proxy setup, nextcloud itself would be running without subpage and on port 80 internally, but the reverse proxy should map redirect external requests to ssl and map the subdirectory?)
- How to add other services? lets say another webservice on port 80 proxied to "https://sameserver.site/website" over that proxy:
web_nginx:
image: nginx
# ports:
# - "80:80"
- maybe a hint how to do redirect to one of the pages by proxy configuration by default?
saw some issues related to this. Am opening a new ticket, as the issues i found were about running nextcloud in some subfolder itself without proxy but doing it in a dangerous way. would like to find a working solution for this to close issues #401 and #1919
The reverse proxy image here is merely the nginx-proxy image.
https://hub.docker.com/r/nginxproxy/nginx-proxy
https://github.com/nginx-proxy/nginx-proxy
The only customization made in the Dockerfile here is the addition of NC specific upload parameters:
https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb/fpm/proxy/Dockerfile
This doesn't necessarily address your query, but it may be a starting point.
@joshtrichards thank you. That basically works - but i do think there is bug in Nextcloud what makes this setup impossible right now.
what i am doing:
- clone this repo
- copy files from https://github.com/nextcloud/docker/tree/master/.examples/docker-compose/with-nginx-proxy/postgres/fpm to some nice place
- do the things on https://github.com/nextcloud/docker/tree/master/.examples#with-nginx-proxy
- start nextcloud+nginx-proxy with docker-compose up -d
- setup nextcloud with proxy and letsencrypt -> works like a charme
- now docker-compose down
- add virtual_path=/nextcloud and virtual_dest=/ in yaml, web
- in nextcloud_data config.php set overwritehost, overwriteprotocol, overwritewebroot, overwrite.cli.url as described in nextcloud- docs
- start nextcloud back again doing occ / update .htaccess
That works: Nextcloud starts from subdirectory - BUT it will not serve Files.
The Error in NC- Log is "Requested uri (/nextcloud/remote.phpp/webdav) is out of base uri (/nextcloud/remote.php/webdav/)" -> so i guess the values of config.php are somewhat messing around.
i am currently setting up a developement-environement to inspect whats going on. This one is nasty, as a small bug (i hope) is preventing that perfect functionality.
if you have any hints concerning that bug, i would be very greatful for any help.
Late on the party, but i think i know where your problem is . The example you used above have a custom nginx conf for the web container, you need to edit that conf file to properly serve the uri-s. Post that nginx.conf(/path/to/whatever/fpm/web/nginx.conf) and i might help you where the problem is.
Thanx, yes that may be the problem here . i thougth thats what the parameter virtual_path and virtual_dest in yml should be for at nginx.
Well i have gone further and am now using subdomains aka nextcloud.hostname.com. I realised that service2.hostname.com works better and is the intended way to do so. For some newby in hosting that may be a worth a word to understand that services should be seperated via subdomains rather than url-paths, To point that out is all i would suggest here.
I would close this one.