Hello,
I recently reinstalled Nextcloud 16 using Docker (Apache version) and using an Nginx reverse proxy, everything went well until I enabled a firewall (using ufw) on my server. When the firewall is active I can’t reach my Nextcloud instance (504 error) despite having opened the ports (80 and 443, the ports for the reverse proxy). Several other apps on the server are configured the same way and work without issue when the firewall is up.
I really don’t understand why this is happening, Nextcloud runs in Docker, the internal 80 port is mapped and Nginx is configured to serve as a very basic reverse proxy (proxy-pass instruction) on a subdomain.
Here is the Nginx config:
# HTTP server, for HTTPS redirection
server {
server_name REDACTED;
listen 80;
return 301 https://$host$request_uri;
}
# HTTPS server
server {
server_name REDACTED;
listen 443 ssl;
# Reverse proxy
location / {
proxy_pass http://localhost:2010;
proxy_set_header X-Real-IP $remote_addr;
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-Forwarded-Proto $scheme;
}
# SSL certs
REDACTED
}
And here is the error from Nginx:
==> error.log <==
2019/07/29 19:52:19 [error] 18497#18497: *31 upstream timed out (110: Connection timed out) while reading response header from upstream, client: <client IP, redacted>, server: <server url, redacted>, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:2010/", host: "<server url, redacted>"
==> access.log <==
83.194.79.67 - - [29/Jul/2019:19:52:19 +0200] "GET / HTTP/1.1" 504 183 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"
The logs make sense but I can’t figure out why it happens only when the firewall is up considering all the ports are opened. Of course it works fine when the firewall is down.
Thanks in advance!