(Depreciated) Looking for help setting up a Reverse Proxy (TrueNAS / FreeBSD / Caddy)

I’m working on setting up a NextCloud instance behind a reverse proxy on a TrueNAS system, running the latest version (12.0-U8.1, as of this posting). I’ve made a lot of progress so far - here’s what’s working:

  • TrueNAS is up and running. :stuck_out_tongue:
  • Caddy server is up at 10.0.0.241
  • gjschaller.homeftp.net is pointing to my router, ports are forwarded to Caddy instance acting as the Proxy
  • Caddy server is serving HTML without issue when the domain is browsed
  • Nextcloud is up and running at 10.0.0.242
  • I am able to access Nextcloud by browsing to the IP address via http, https is not enabled.

Where I am running into an issue:

I’ve done a bunch of legwork on the TrueNAS forums getting as far as I could, but I suspect at this point that the issue is my Nextcloud config. My current, working config is below - what do I need to add to it, to make it viewable via a reverse proxy running at 10.0.0.241, with the domain gjschaller.homeftp.net associated with it?

<?php
$CONFIG = array (
'passwordsalt' => '(Redacted)',
'secret' => '(Redacted)',
'trusted_domains' =>
array (
0 => 'localhost',
1 => '10.0.0.242',
),
'datadirectory' => '/mnt/files',
'dbtype' => 'mysql',
'version' => '23.0.4.1',
'overwrite.cli.url' => 'http://localhost',
'dbname' => 'nextcloud',
'dbhost' => 'localhost:/tmp/mysql.sock',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => '(Redacted)',
'installed' => true,
'instanceid' => '(Redacted)',
'logtimezone' => 'America/New_York',
'default_phone_region' => 'US',
'log_type' => 'file',
'logfile' => '/var/log/nextcloud/nextcloud.log',
'loglevel' => '2',
'logrotate_size' => '104847600',
'memcache.local' => '\\OC\\Memcache\\APCu',
);

Hi @GJSchaller,
You are missing the required support template. Please fill this form out and edit into your post.

Are you able to access your nc by ip?
You must add the subdomain url you want to use in Trusted domains. Note how it is missing from there.

This will give us the technical info and logs needed to help you! Thanks.

i’d rather ask that question on a TrueNAS / FreeBSD / Caddy-Forum.

I did, and they referred me to here.

Your Nextcloud config.php configuration should look something like this for your reverse proxy to work correctly.

trusted_domains’ =>
array (
0 => ‘Domain Name’,
1 => ‘Nextcloud Server IP’,
2 => ‘Reverse Proxy Server IP’,
),
‘trusted_proxies’ => ‘Reverse Proxy Server IP’,
‘overwriteprotocol’ => ‘https’,
‘overwritehost’ => ‘Domain Name’,
‘overwritecondaddr’ => ‘^00.00.000.00$’, <---- This is the reverse proxy IP broken down.
‘forwarded-for-headers’ =>
array (
0 => ‘X-Forwarded-For’,
1 => ‘HTTP_X_FORWARDED_FOR’,
),
‘overwrite.cli.url’ => ‘https://Domain Name/nextcloud’,

Here is the link for reference.

https://docs.nextcloud.com/server/20/admin_manual/configuration_server/reverse_proxy_configuration.html

2 Likes

good gawd! Well I think it could turn out to be difficult to find someone setting up caddy for you. But well, you’re here so let’s hope the best.

Have you searched the forum for caddy setups already?

I got some additional (late) feedback from the TrueNAS forums - I’ll try a mix of what’s here, and what’s there, and report back if successful.

Could you please link over the truenas forum posts so we can follow along.

Can you please link the Caddy post.

I’m both in the process of moving my domain to a new registrar, and about to leave for a week’s vacation - I’ll follow up on this once I’m back online and can properly update my original post.

For documentation purposes, I am abandoning this attempt, and making a new one using a sub-domain instead of a directory. I’ll start a new thread if I run into issues.