How can I install inside a specific directory, using docker

Hi all,

First, thanks for the amazing work that goes in to OwnCloud.

On to my question. I’ve noticed in the help documentation that it’s possible to change the url of the owncloud instance. I’d like to place owncloud in a directory. I’d hope the relevant part of my nginx entry would look like this, if that helps:

location /files {
    rewrite ^/files/?(.*)$ /$1 break;
    proxy_pass http://localhost:8080/;
    include /etc/nginx/proxy_params;
}

This allows me then to have my main content at https://my-crazy-web-site.com, but place the owncloud instance at https://my-crazy-web-site.com/files. However, being ultimately fairly lazy, I’d ideally like to do this using Docker rather than goign through and installing it myself. Is that possible, and if so … how?

First I would recommend to have a look in the docs, there is a pretty good manual for setting up an ownCloud environment with docker-compose:
https://doc.owncloud.org/server/admin_manual/installation/docker/

In the base docker image you can find the environment variables available for configuration. There you should also be able to configure your owncloud to work in a directory.

Then you’ll have to configure your nginx as reverse proxy in front of it. (This could also be dockerized)

Sorry, I can’t give you a more in depth manual to follow, but perhaps you can document your path to a working setup here? :wink:

1 Like

Heya - thanks, that’s perfect … I’d not noticed the list of environmental variables - that’s very handy. I’ll, of course, document whatever I end up doing here :slight_smile:

1 Like

This turned out to be really easy:

First, add the following environmental variable to the docker-compose.yml file:

OWNCLOUD_SUB_URL=/files (under services->owncloud->environment)

Next, add this to the nginx config for the site:

location /files {
    proxy_pass http://localhost:8080/files/;
    include /etc/nginx/proxy_params;
}

And … you’re done. It’s that simple.

2 Likes