I have searched this forum for a solution, but wasn’t been able to get it to work. I’m running NextCloud in a docker container. My host machine is running a few webservers with an nginx reverse proxy, on my.server/sonarr, my.server/transmission, etc.
I would like to have my nextcloud on my.server/nextcloud.
So far I’ve been following this document, but have been getting a 502 bad gateway error.
My config files are as follows:
Nextcloud config.php
Nginx reverse_proxy
Anybody got a clue what is going wrong?
Hello Elmardus,
I’m having similar environment as you. I’m using nginx as proxy to redirect to apache virtual hosts and all this on raspberry pi 4 and noip.com for DNS
I also want to run NC in docker but I get the same error as you bad gateway 502.
I’m curious, did you setup docker network for NC ? Also as I understand I proxypass nginx to docker container with NC, and adding the port, because I’m using ports, as far as I remember for NC you need 4443, 443 and 80. Actually I’m using this https://ownyourbits.com/nextcloudpi/ and command docker run -d -p 4443:4443 -p <custom_port>:443 -p <custom_port>:80 -v ncdata:/data --name nextcloudpi ownyourbits/nextcloudpi $DOMAIN. Any ideas are very welcome, especially nginx proxy config And why we need 4443 port btw ?
why do you expose these ports?
if your nginx reverse proxy is running in a docker container you set
proxy_pass http://nextcloudpi:80;
.
Hi Reiner_Nippes, no my nginx-proxy is running directly on raspbian (debian buster 10).
can you access nextcloudpi without proxy via the custom ports?
is it up&running? docker logs nextcloudpi
?
btw: 4443 is the admin panel of nextcloupi.
https://docs.nextcloudpi.com/en/how-to-access-nextcloudpi/
nginx config
`server {
server_name mydomain.com;
location / {
proxy_pass http://192.168.178.10:443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Remote-Port $remote_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
index index.html index.htm index.nginx-debian.html;
}`
in browser https://192.168.178.10:443
You don't have permission to access / on this server.
tested this, btw works fine, locally and with noip dns
docker run -d -p custom_port:80 nextcloud