-
Notifications
You must be signed in to change notification settings - Fork 35
Reverse proxy example (using Apache)
The following is an example of how to setup a reverse proxy for this ownCloud container using the Apache web server.
You might want to do this if you'd like to to integrate owncloud with your existing Apache based web site. This page describes how you can run the the Docker ownCloud container on some machine on your lan that doesn't have a public IP address and use another machine on your lan that does have a public IP as a portal (or reverse proxy) for the ownCloud server. That way you can access your ownCloud from anywhere on the internet through your existing web site. This is a very basic tutorial that can be used as a starting point for a more complicated configuration. As such, I will only describe http access through port 80, getting https to work is more complicated. I might add additional instructions for getting that to work later if I feel like it. Note that there are plenty of alternate ways to accomplish the steps given in the procedure below, modify them to suit your needs.
Assumptions
- Your local area network's domain name is
lan
- You own the domain
mydomain.com
on the Internet - You have at least two computers on your lan with hostnames
a.lan
andb.lan
: -
a.lan
has docker installed (it will run the ownCloud image from this repo)- It might not be accessible from outside your lan
-
b.lan
also has a public IP address in which is pointed to byb.mydomain.com
- This machine has Apache with the mod_proxy module installed.
- It already serves content accessible through
http://b.mydomain.com
- Your lan's dns server is setup properly to resolve hosts
a.lan
andb.lan
Procedure (from scratch)
Follow this if you're starting with a fresh ownCloud server instance.
- Start a fresh ownCloud Docker container on
a.lan
:
docker run --name oc -p 80:80 -p 443:443 -d l3iggs/owncloud
- Add the following two lines to your Apache configuration file on
b.lan
and then restart it's apache instance so that the changes are applied:
ProxyPass "/owncloud" "http://a.lan/owncloud"
ProxyPassReverse "/owncloud" "http://a.lan/owncloud"
- Browse to
http://b.mydomain.com/owncloud
from anything with internet access and complete the setup of your ownCloud server.
Procedure (from existing ownCloud setup)
Follow this if you have an already working ownCloud server.
- Start your existing ownCloud Docker container however you normally do on
a.lan
(ensuring that it is serving owncloud via http to port 80) - Use a browser to log into your ownCloud server as a user with admin permissions.
- Once logged in on the main page of ownCloud, your URL should end with
/index.php/apps/files
. Change the end of the URL so that instead it looks like this:/index.php/settings/admin?trustDomain=b.domain.com
and hit enter. You'll get a dialog box asking if you'd like to confirm adding this domain, click Yes.
Now your reverse proxy is setup and you can access ownCloud by visiting http://b.mydomain.com/owncloud