How To Install Nextcloud behind a secure reverse proxy (ARM)

Discussion about Docker
User avatar
StephenM
Posts: 69
Joined: 11 Jan 2021, 21:55

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by StephenM »

Just a few last steps now....

Code: Select all

vi /mnt/md0/appdata/docker/volumes/nextcloud_nextcloud/_data/config/config.php
Put it in insert mode and navigate around until you find this section:

Code: Select all

'trusted_domains' =>
  array (
    0 => '192.168.1.100:8080',
    1 => 'nextcloud.mydomain.com',
    2 => 'UNRAID IP:PORT',
Edit it until it looks like the above.

Find or create this section and edit it to look like this:

Code: Select all

'trusted_proxies' =>
  array (
    0 => '192.168.1.0/24',
  ),
Add this section at the end:

Code: Select all

 'forwarded_for_headers' =>
  array (
    0 => 'X-Forwarded-For',
    1 => 'HTTP_X_FORWARDED_FOR',
  ),
To stop your Raid filling up with trash, add this line time:

Code: Select all

'trashbin_retention_obligation' => '30, 60',
Once you've done that, try logging to Nextcloud from the outside world.

https://nextcloud.mydomain.com

Finger's crossed you can log in with your admin user.

That's it, you're up and working.
User avatar
StephenM
Posts: 69
Joined: 11 Jan 2021, 21:55

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by StephenM »

As an afterthought I was having some issues with the website not using https on occasion.

Change the proxy host setting under SSL to force secure.
User avatar
StephenM
Posts: 69
Joined: 11 Jan 2021, 21:55

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by StephenM »

Having just upgraded TNAS.....

The ports 80 and 443 are in use by the OS to I did something first time round to overcome this but it seems not to have persisted beyond an upgrade.

A quick mod has fixed this in the docker-compose.yml :

Change to this:

Code: Select all

proxy:                                                                                                                                                             
    image: 'jc21/nginx-proxy-manager:latest'                                                                                                                         
    restart: always                                                                                                                                                  
    ports:                                                                                                                                                           
      # Public HTTP Port:                                                                                                                                            
      - '2080:80'                                                                                                                                                      
      # Public HTTPS Port:                                                                                                                                           
      - '2443:443'                                                                                                                                                    
      # Admin Web Port:                                                                                                                                              
      - '81:81'                                                                                                                                                      
    environment:
Leave the rest of the file as is.

Change your router port forwarding to forward 80 to 2080 on 192.168.1.200 and also 443 to 2443 on 192.168.1.200
User avatar
StephenM
Posts: 69
Joined: 11 Jan 2021, 21:55

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by StephenM »

StephenM wrote: 15 Jan 2021, 03:04 As an afterthought I was having some issues with the website not using https on occasion.

Change the proxy host setting under SSL to force secure.
Actually - Doing this causes some strange problems with the desktop app and logging in.

You get egg timers for ever with this setting set.

Odd - don't see why that should be the case.
User avatar
StephenM
Posts: 69
Joined: 11 Jan 2021, 21:55

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by StephenM »

Sorry - I wish I could go back and edit - it would make this much more readable.

Here are some more changes you need in your config.php file.

I had to change one line and add 3

Code: Select all

  'overwrite.cli.url' => 'https://nextcloud.mydomain.com',
  'overwriteprotocol' => 'https',
  'overwritehost' => 'nextcloud.mydominc.com',
This probably means that you can force SSL in the proxy rule, but I haven't tested that yet.
User avatar
yerc1
Posts: 85
Joined: 30 Oct 2020, 15:50

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by yerc1 »

{L_BUTTON_AT}StephenM
Fantastic! Thanks for sharing... I have uninstalled the out-of-support Nextcloud app after months of waiting for an update... I am just getting ready to install NextcloudPi on Docker when I saw your post.
F2-221
is my first NAS, bought in October 2020
User avatar
yerc1
Posts: 85
Joined: 30 Oct 2020, 15:50

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by yerc1 »

TM Support, how Stephen detailed the steps within a context, is what I meant in my other post (post #3 of the thread).
F2-221
is my first NAS, bought in October 2020
User avatar
StephenM
Posts: 69
Joined: 11 Jan 2021, 21:55

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by StephenM »

Could a board admin give me the ability to edit my posts until midnight 16th January 2021 GMT please - This needs tidying up and I can't because the posts are not editable by me.
User avatar
TMS
TerraMaster Team
Posts: 508
Joined: 20 Oct 2020, 17:06

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by TMS »

Sorry,I also don’t have permission. You can tell me what needs to be modified, and I can modify it for you (more details on the modification), or you can open another post.
To contact our tech team, please email to support(at)terra-master.com, remember to replace (at) with @
User avatar
yerc1
Posts: 85
Joined: 30 Oct 2020, 15:50

Re: How To Install Nexccloud behind a secure reverse proxy (ARM)

Post by yerc1 »

TMS wrote: 15 Jan 2021, 22:35 Sorry,I also don’t have permission. You can tell me what needs to be modified, and I can modify it for you (more details on the modification), or you can open another post.
According to the forum FAQ

Code: Select all

What are Administrators?
Administrators are members assigned with the highest level of control over the entire board. These members can control all facets of board operation, including setting permissions, banning users, creating usergroups or moderators, etc., 
Is there someone in your Team with an Administrator access to possibly give StephenM the ability to edit his post?
F2-221
is my first NAS, bought in October 2020
Locked