Score:0

Nginx reverse proxy subfolder with nextcloud

in flag

I have a Nextcloud server deployed at address 192.168.6.20 (snap install with ubuntu 20.04 LTS). It's a plain http, so no https. If I point a browser to http://192.168.6.20 it works.

Now I want another server to be its nginx reverse proxy, by pointing at https://frontend.mydomain.com/cloud I would like to access the nextcloud install.

I'm in trouble with the fact I want to access using a subdirectory /cloud on the frontend. In the Nginx configuration I wrote something like:

upstream nextcloud {
server 192.168.6.20:80;
keepalive 32;
}
location ~ ^/cloud/(.*) {
rewrite  ^/cloud/(.*) /$1 break;
client_max_body_size 50M;
proxy_set_header Connection "";
proxy_set_header Host $http_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;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_http_version 1.1;
proxy_pass http://nextcloud;
proxy_redirect off;
}

But all I get is an unformatted white page with some text complaining that I'm not connecting from a trusted ip. Besides the complaint, the page is white with unformatted text, so there's something not working. If, for example, I create another configuration file to let the url be http://frontend.mydomain.com without the path /cloud and I create it as:

upstream nextcloud {
server 192.168.6.20:80;
keepalive 32;
}
location / {
client_max_body_size 50M;
proxy_set_header Connection "";
proxy_set_header Host $http_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;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_http_version 1.1;
proxy_pass http://nextcloud;
proxy_redirect off;
}

it works: I mean, it still complains for the untrusted source, but the page is well formatted, with form texts, blue background and so on.

How can I achieve what I need? What am I missing/doing wrong?

Score:0
pr flag
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.