Nginx root inside a docker container -
i'm trying run nextcloud docker in subdir pointing /var/www/nextcloud in nginx docker.
but no matter do, nginx continues try serve /var/www/nextcloud/nextcloud when access it.
this ngix.conf (notice root /var/www; line)
user www-data; http { upstream backend { server nextcloud:9000; } upstream php-handler { server nextcloud:9000; } server { listen 80; # add headers serve security related headers # before enabling strict-transport-security headers please read # topic first. #add_header strict-transport-security "max-age=15768000; # includesubdomains; preload;"; add_header x-content-type-options nosniff; add_header x-xss-protection "1; mode=block"; add_header x-robots-tag none; add_header x-download-options noopen; add_header x-permitted-cross-domain-policies none; # path root of installation root /var/www; location = /robots.txt { allow all; log_not_found off; access_log off; } # following 2 rules needed user_webfinger app. # uncomment if you're planning use app. # rewrite ^/.well-known/host-meta /nextcloud/public.php?service=host-meta # last; #rewrite ^/.well-known/host-meta.json # /nextcloud/public.php?service=host-meta-json last; location = /.well-known/carddav { return 301 $scheme://$host/nextcloud/remote.php/dav; } location = /.well-known/caldav { return 301 $scheme://$host/nextcloud/remote.php/dav; } location /.well-known/acme-challenge { } location ^~ /nextcloud { # set max upload size client_max_body_size 512m; fastcgi_buffers 64 4k; # enable gzip not remove etag headers gzip on; gzip_vary on; gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # uncomment if server build ngx_pagespeed module # module not supported. #pagespeed off; location /nextcloud { rewrite ^ /nextcloud/index.php$uri; } and have following in nginx docker-compose.yml (notice - /mnt/server/nextcloud:/var/www/nextcloud line in volumes:
web: image: nginx container_name: nginx-webserver volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - /mnt/server/nextcloud:/var/www/nextcloud external_links: - nextcloud environment: - virtual_host=${domain} - virtual_network=nginx-proxy - virtual_port=80 - letsencrypt_host=${domain} - letsencrypt_email=myemail networks: - proxy-tier restart: networks: proxy-tier: external: name: nginx-proxy and docker-compose.yml nextcloud (notice - /mnt/server/nextcloud/:/var/www/html/ line volumes):
version: '2' services: nextcloud: image: nextcloud:fpm container_name: nextcloud links: - db volumes: - /mnt/server/nextcloud/:/var/www/html/ - /mnt/server/nextcloud/apps:/var/www/html/apps/ - /mnt/server/nextcloud/config:/var/www/html/config/ - /mnt/server/nextcloud/data:/var/www/html/data/ networks: - proxy-tier restart: networks: proxy-tier: external: name: nginx-proxy
Comments
Post a Comment