Nginx Redirecting to http not working

Dear Community,
i´ve been struggling with setting up a new Nextcloud AIO in the following environment:

Internet → NGINX Reverse Proxy → Nextcloud AIO with NGINX ProxyManager

The NC setup is done and i can reach the cloud from internal network without any issues, via http://ip:11000 for instance which redirects me to https://cloud.mydomain.com. From external networks i just get “502 Bad Gateway” from the Reverse Proxy.

My problem is the first NGINX Reverse Proxy. I tried several different configs but somehow the NGINX is always redirecting to https://ip:11000 instead of http://ip:11000 and i have no explanation for it. There are other machines in this Proxy configured, some of them are also using proxy_pass http:// and they are working.

Here is the site actual site config:

server { listen 443 ssl; http2 on;

server_name cloud.mydomain.com;
client_max_body_size 0;

location / {
    proxy_pass http://192.168.XX.XX:11000$request_uri;       
    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;

}


}

And here is what the ReverseProxy logs when i try to reach NC from the outside:

2024/10/28 17:41:30 [crit] 34#34: *739 SSL_do_handshake() failed (SSL: error:0A0000C6:SSL routines::packet length too long error:0A000139:SSL routines::record layer failure) while SSL handshaking to upstream, client: 84.XX.XX.XX, server: [cloud.mydomain.com](http://cloud.mydomain.com), request: "GET / HTTP/2.0", upstream: "https://192.168.XX.XX:11000/", host: "[cloud.mydomain.com](http://cloud.mydomain.com)"

As you can see it redirects to https which is not working.

The NGINX Proxy Manager holds a vaild wild-card certificate and has configured a Proxy Host redirecting cloud.mydomain.com to http://ip:11000.

Any ideas how to get this working from the outside?

Greetings

Hi, can you follow all-in-one/reverse-proxy.md at main · nextcloud/all-in-one · GitHub?

I did as good as i could. Nextcloud is already working but as i pointed out it´s only accessible from the inside.

Just checking with you as for example the nginx config does not look like the one we provide

No, because it´s the config from the NGINX which is infront of the NGINX ProxyManager which is the same machine as NC.

I see but why do you have 2 rps in front of aio in a chain?

You can take a look at my working settings. - Docker based NextCloud AiO with nginx on separate Ubuntu VM - not working - #6 by vawaver
Maybe it helps.

I have to rps because i did not find a way to make NC locally available without the NGINX Proxy Manager. With the second rp i can handle the certificate´s i already have and redirect the cloud domain to the Apache.

The first rp i can not avoid, it´s part of the network and it´s the machine which get´s 80 and 443. from the internet.

I don´t understand why the first rp is passing to https.

@vawaver
Unfortunately not, i have two rp´s.

This topic was automatically closed after 90 days. New replies are no longer allowed.