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

Trick to run docker nextcloud fpm with nginx in a sub directory #1919

Closed
chen-xin opened this issue Feb 11, 2023 · 3 comments
Closed

Trick to run docker nextcloud fpm with nginx in a sub directory #1919

chen-xin opened this issue Feb 11, 2023 · 3 comments
Labels
cleanup (ignore): subs integration: proxy Integrating with a reverse proxy needs info Additional info needed to triage question

Comments

@chen-xin
Copy link

The official nextcloud fpm image is great but it does not support mounting to a sub directory.
It took me two long days to find this trick, record here for someone might need:

  1. Compose for initialize. Note: navigate to https://my.site/nextcloud now will raise 404:
services:
  nginx:
    image: nginx:stable-alpine
    container_name: nginx1
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/conf.d:/etc/nginx/conf.d
      - ./nginx/certs:/etc/ssl/nginx
        # - ${DATA_VOLUME}/www:/www
        # - ${DATA_VOLUME}/nextcloud:/www/nextcloud
      - ${DATA_VOLUME}/www:/var/www/html
      - ${DATA_VOLUME}/nextcloud:/var/www/html/nextcloud
    restart: unless-stopped

  nextcloud:
    image: nextcloud:fpm-alpine
    container_name: nextcloud1
    restart: unless-stopped
      # ports:
      # - 9000:9000
    volumes:     
      - ${DATA_VOLUME}/nextcloud:/var/www/html
      # use the following config instead of above after nextcloud initialized itself:
      # - ${DATA_VOLUME}/nextcloud:/var/www/html/nextcloud 
  1. Modify last line of compose file as comments and restart containers. Note: use the modified version BEFORE initialize will cause cannot delete non-empty directory: nextcloud.
@obel1x
Copy link

obel1x commented May 27, 2023

This might be no good solution. On https://stackoverflow.com/a/49861267 i have read that Nextcloud will use rsync on /var/www/html and delete all paths unknown to base installation - so subfolder "nextcloud" and ALL CONTAINING DATA could be silently removed when updating? i have not testet that, but the right solution i would like to use is to use a nginx-proxy for that.
Currently i am testing with this example: https://github.com/nextcloud/docker/tree/master/.examples/docker-compose/with-nginx-proxy/postgres/fpm but unfortunatelly had no luck to setup virtual paths.

maybe we both search for a solution at #401 ?

@joshtrichards
Copy link
Member

The official nextcloud fpm image is great but it does not support mounting to a sub directory.

Do you actually need Nextcloud to be installed in a subdirectory or merely reachable via a subdirectory? If the latter, just put a reverse proxy in front. If the former, why?

@joshtrichards
Copy link
Member

#2276 (comment)

@joshtrichards joshtrichards closed this as not planned Won't fix, can't repro, duplicate, stale Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup (ignore): subs integration: proxy Integrating with a reverse proxy needs info Additional info needed to triage question
Projects
None yet
Development

No branches or pull requests

4 participants