Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx-proxy: Howto server multiple Sites on one host? (Nextcloud in subdirectory) #1992

Closed
obel1x opened this issue May 27, 2023 · 4 comments
Labels
examples Compose/Dockerfile/etc integration: proxy Integrating with a reverse proxy question

Comments

@obel1x
Copy link

obel1x commented May 27, 2023

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

@joshtrichards
Copy link
Member

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.

@obel1x
Copy link
Author

obel1x commented May 28, 2023

@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:

  1. clone this repo
  2. copy files from https://github.com/nextcloud/docker/tree/master/.examples/docker-compose/with-nginx-proxy/postgres/fpm to some nice place
  3. do the things on https://github.com/nextcloud/docker/tree/master/.examples#with-nginx-proxy
  4. start nextcloud+nginx-proxy with docker-compose up -d
  5. setup nextcloud with proxy and letsencrypt -> works like a charme
  6. now docker-compose down
  7. add virtual_path=/nextcloud and virtual_dest=/ in yaml, web
  8. in nextcloud_data config.php set overwritehost, overwriteprotocol, overwritewebroot, overwrite.cli.url as described in nextcloud- docs
  9. 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.

@joshtrichards joshtrichards added question examples Compose/Dockerfile/etc integration: proxy Integrating with a reverse proxy labels Oct 23, 2023
@tzerber
Copy link
Contributor

tzerber commented Dec 15, 2023

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.

@obel1x
Copy link
Author

obel1x commented Dec 17, 2023

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.

@joshtrichards joshtrichards closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Compose/Dockerfile/etc integration: proxy Integrating with a reverse proxy question
Projects
None yet
Development

No branches or pull requests

3 participants