Answer the question
In order to leave comments, you need to log in
How to put ownCloud behind Nginx in Docker?
I need to access my ownCloud instance via Nginx, both of which are in separate Docker containers. I created docker-compose.yml :
nginx:
image: nginx
ports:
- 80:80
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
links:
- owncloud
owncloud:
image: owncloud
ports:
- 6789:80
volumes:
- ~/ownCloud:/var/www/html/data
http {
server {
listen 80 default;
server_name docker.dev;
location / {
proxy_pass http://127.0.0.1:6789;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
events {}
[error] 6#6: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.99.1, server: docker.dev
Answer the question
In order to leave comments, you need to log in
The problem is that it proxy_pass http://127.0.0.1:6789;
looks at its own container and not at the service owncloud
. Fortunately , it docker-compose
adds the addresses of services to /etc/hosts
, which can be seen by running the command docker exec nginx cat /etc/hosts
, there will be a line 172.17.0.2 owncloud 8a567934bb13
.
So if you change docker-compose.yml
, replacing ports: - 6789:80
with expose: - 80
, and nginx.conf
, replacing the value proxy_pass
with http://owncloud;
- everything will work.
Better take this one: https://github.com/nazar-pc/docker-webserver-apps/...
There, the update procedure is described (which you will have to do anyway), and everything is configured as expected (including LibreOffice for support for MS Office documents).
Based on https://github.com/nazar-pc/docker-webserver , which means there are ready-made backup and restore scripts.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question