Owncloud 8 with Docker behind nginx available through subdirectory -


i want run severel services/pages behind nginx. each service shall available through subdirectory instead of subdomain.

i'am using jwilder/nginx-proxy proxy container:

nginx_proxy:   image: jwilder/nginx-proxy   container_name: nginx-proxy   ports:     - 80:80   volumes:     - /var/run/docker.sock:/tmp/docker.sock 

and owncloud container:

web:   image: owncloud:8.1   container_name: my_owncloud   environment:     - virtual_host=www.example.com   ports:     - 8081:80 

the modified nginx config:

# if receive x-forwarded-proto, pass through; otherwise, pass along # scheme used connect server map $http_x_forwarded_proto $proxy_x_forwarded_proto {   default $http_x_forwarded_proto;   ''      $scheme; } # if receive upgrade, set connection "upgrade"; otherwise, delete # connection header may have been passed server map $http_upgrade $proxy_connection {   default upgrade;   '' close; } gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; log_format vhost '$host $remote_addr - $remote_user [$time_local] '                  '"$request" $status $body_bytes_sent '                  '"$http_referer" "$http_user_agent"'; access_log off;  # http 1.1 support proxy_http_version 1.1; proxy_buffering off; proxy_set_header host $http_host; proxy_set_header upgrade $http_upgrade; proxy_set_header connection $proxy_connection; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header x-forwarded-proto $proxy_x_forwarded_proto;  upstream cloud {         server 172.17.0.3:80: } server {         server_name domain.org www.domain.org;         listen 80;         access_log /var/log/nginx/access.log vhost;          index index.html index.htm index.php;         root /var/www/main;          location /cloud/ {                 proxy_pass http://cloud/;         }          location / {                 proxy_pass http://www.some-domain.com/;         }          location /sub/ {                 alias /var/www/sub/;         }  } 

the problem owncloud tries load styles, images, etc. / instead of /cloud. owncloud working , reachable domain.org:8081. have add rewrite, proxy_redirect or other stuff?

you can use 'overwritewebroot' as described in manual. edit owncloud's 'config/config.php' , include:

<?php $config = array (     ...     'overwritewebroot' => '/cloud',     ... ); 

then owncloud consider '/cloud/' base internal url (e.g., images, styles, etc.).


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -