Nginx reverse proxy in front of nginx/nextcloud

Hi I’m running nextcloud 18.3 with nginx as a frontend on freebsd. All is well and things are running with SSL certs.

What I’m trying to do is stick an nginx reverse proxy in front of my nginx/nextcloud installation – and well this is where things are not working.

I tested the reverse proxy and ensured it can serve up a simple webpage (prior to adding the proxy_pass statements) so I’ve verified the reverse proxy is reachable and can server a simple web page.

My test setup is a VM running an nginx reverse proxy known as test.example.com that proxies to https://nextcloud.example.com

My reverse proxy (which is running in a separate VM than nginx/nextcloud) is configured like this for proxy_pass to nextcloud:

        location / {
      proxy_ssl_verify off;
      proxy_ssl_verify_depth 2;
	  proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_pass https://nextcloud.example.com;
}

I’m not sure if I was supposed to change the nextcloud config file but I added the following:

  'trusted_proxies' =>
  array (
    0 => 'localhost',
    1 => 'test.example.com',
    2 => '10.0.1.86',
  ),

The ip address of test.example.com is 10.0.1.86

I can’t even get to first base on my setup — I get to the actual nextcloud page (which is good), but when I try to login I’m rejected with wrong username/password.

Perhaps I’ve tried so many times "I’ve banned myself since I see this in the logs:

n","message":"Login failed: nc_admin (Remote IP: 10.0.1.184)","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:75.0) Gecko/20100101 Firefox/75.0","version":"18.0.3.0"}

`{"reqId":"uOMq1ER1jkgt61lrh2g3","level":1,"time":"April 13, 2020 19:02:49","remoteAddr":"10.0.1.184","user":"--","app":"core","method":"POST","url":"/login","message":"Bruteforce attempt from \"10.0.1.184\" detected for action \"login\".","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:75.0) Gecko/20100101 Firefox/75.0","version":"18.0.3.0"}`

I’m kind of confused where to go now.

Yea – I made it past the first stage

I think the problem was blacklist from repeatedly trying to login. I downloaded the app bruce force settings and whitelisted my IP. So good to go there.

However know I have a new problem

On displaying the main page, I’m getting connection to server lost from nextcloud. It shows a few files and then I get the error.

The log files don’t show much. Is there a timeout setting I need to adjust?