Configuring ownCloud in Existing NGINX Reverse Proxy


#1

Hey Guys -

I’m just set up ownCloud 10 in a Docker container which is accessed directly via http://192.168.0.21:8282. I already have NGINX configured on a different local system which hosts an internal webpage, acts as reverse proxy for numerous local hosted apps, and applies SSL for all of these forwarded webapps.

I’ve tried to find an example of a config that would work for my environment, but seemingly all examples are for NGINX config files dedicated to ownCloud.

The typical template for adding one of these webapps to NGINX’s reverse proxy which also requires the set location matches an existing url base. This would probably work if I could access ownCLoud directly via http://192.168.0.21:8282/owncloud. Although browsing to that address does start to work, clicking any links removes “/owncloud” from the URL. Below is the config template discussed:

location /owncloud {
proxy_pass http://192.168.0.21:8282/owncloud;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;
}

The goal is to be able to access ownCloud via https://mydomain.com/owncloud. Although I knew it wouldn’t work, testing this address using the config above redirects to https://mydomain.com/login then displays a 404 after a few seconds.

Any suggestions for what I need to do to get this working either by adding “/owncloud” to the installation or a NGINX config that would work without needing “/owncloud”? Thanks!

Update
While reading further after posting, I decided to try something so edited the below 2 lines in config.php

‘overwrite.cli.url’ => ‘http://localhost/’,
‘htaccess.RewriteBase’ => ‘/’,

and changed them to:

‘overwrite.cli.url’ => ‘http://localhost/owncloud’,
‘htaccess.RewriteBase’ => ‘/owncloud’,

I restarted the containers then tried browsing to http://192.168.0.21:8282/owncloud, but it again immediately redirected me to http://192.168.0.21:8282/apps/files/. I attempted https://mydomain.com/owncloud again using the same config above, but got the same results as prior to the change. I then tried adding a backslash to the end of each of the 2 lines, but no change there either.

I’m looking for the owncloud.conf file to see if I can test changes there too, but have been unable to find it so far in any of the volumes of the 3 containers (ownCloud Files, mySQL, & Backup).

Thanks


#2

Nevermind Guys -

I went ahead and deleted the containers and started from scratch. I found that adding the variable “OWNCLOUD_SUB_URL” to “/owncloud” when running the container allows you to set the path from the getgo instead of it installing to the base of the URL. I did that which worked then the NGINX config I mentioned above worked too.

Thanks