unable to access nextcloud using reverse proxy


Recommended Posts

Hey guys. Having some issues with nextcloud/swag setup. Hoping someone can point me in the right direction here. What I am trying to accomplish is to use SSL/Letsencrypt to access my resources ONLY locally. In unraid I've configured swag in bridge0 network which is on my local network.

I created a DNS record of nextcloud.mydomain.com pointing to 10.100.100.4 (SWAG proxy)

Configured the config file for nextcloud as per below

Configured the .conf file in SWAG for nextcloud as per below

When I try to access nextcloud.mydomain.com it gives me a 502 Bad Gateway

When I try to access via the IP of 10.100.100.20:444 it rewrites the url to nextcloud.mydomain.com and I get a bad gateway. Not sure what I'm doing wrong here. Any pointers?

 

image.png.c24ef61a173e2662937342f86a35ee49.png

<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => 'ocsdasd21a45',
  'passwordsalt' => '##',
  'secret' => '##',
  'trusted_domains' => 
  array (
    0 => '10.100.100.20:444',
	1 => 'nextcloud.mydomain.com',
  ),
  'trusted_proxies' => ['swag'],
  'overwrite.cli.url' => 'https://nextcloud.mydomain.com',
  'overwritehost' => 'nextcloud.mydomain.com',
  'overwriteprotocol' => 'https',
  'dbtype' => 'mysql',
  'version' => '20.0.5.2',
  
  'dbname' => 'nextcloud',
  'dbhost' => '10.100.100.20:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'mypassword',
  'installed' => true,
);
---------------------------------------------------

## Version 2020/12/09
# make sure that your dns has a cname set for nextcloud
# assuming this container is called "swag", edit your nextcloud container's config
# located at /config/www/nextcloud/config/config.php and add the following lines before the ");":
#  'trusted_proxies' => ['swag'],
#  'overwrite.cli.url' => 'https://nextcloud.your-domain.com/',
#  'overwritehost' => 'nextcloud.your-domain.com',
#  'overwriteprotocol' => 'https',
#
# Also don't forget to add your domain name to the trusted domains array. It should look somewhat like this:
#  array (
#    0 => '192.168.0.1:444', # This line may look different on your setup, don't modify it.
#    1 => 'nextcloud.your-domain.com',
#  ),

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name nextcloud.mydomain.com;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        proxy_pass https://10.100.100.20:444;
        proxy_max_temp_file_size 2048m;
    }
}
 

 

 

 

 

Edited by fluxcapacitor
Link to comment
41 minutes ago, simono5 said:

No particular help (sorry), I don't use Swag.

 

Have you tried NGINXProxyManager?  Much easier to use and no config files to mess with.

 

Just forward the port on the firewall and create a Proxy Host.  Job done.

Can you clarify what you mean by forwarding  the port on the firewall? I'm trying to keep everything internal and not open any ports on the FW for any external access. 

Link to comment
  • 3 months later...
On 1/21/2021 at 8:23 AM, fluxcapacitor said:

Hey guys. Having some issues with nextcloud/swag setup. Hoping someone can point me in the right direction here. What I am trying to accomplish is to use SSL/Letsencrypt to access my resources ONLY locally. In unraid I've configured swag in bridge0 network which is on my local network.

I created a DNS record of nextcloud.mydomain.com pointing to 10.100.100.4 (SWAG proxy)

Configured the config file for nextcloud as per below

Configured the .conf file in SWAG for nextcloud as per below

When I try to access nextcloud.mydomain.com it gives me a 502 Bad Gateway

When I try to access via the IP of 10.100.100.20:444 it rewrites the url to nextcloud.mydomain.com and I get a bad gateway. Not sure what I'm doing wrong here. Any pointers?

 

image.png.c24ef61a173e2662937342f86a35ee49.png


<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => 'ocsdasd21a45',
  'passwordsalt' => '##',
  'secret' => '##',
  'trusted_domains' => 
  array (
    0 => '10.100.100.20:444',
	1 => 'nextcloud.mydomain.com',
  ),
  'trusted_proxies' => ['swag'],
  'overwrite.cli.url' => 'https://nextcloud.mydomain.com',
  'overwritehost' => 'nextcloud.mydomain.com',
  'overwriteprotocol' => 'https',
  'dbtype' => 'mysql',
  'version' => '20.0.5.2',
  
  'dbname' => 'nextcloud',
  'dbhost' => '10.100.100.20:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'mypassword',
  'installed' => true,
);
---------------------------------------------------

## Version 2020/12/09
# make sure that your dns has a cname set for nextcloud
# assuming this container is called "swag", edit your nextcloud container's config
# located at /config/www/nextcloud/config/config.php and add the following lines before the ");":
#  'trusted_proxies' => ['swag'],
#  'overwrite.cli.url' => 'https://nextcloud.your-domain.com/',
#  'overwritehost' => 'nextcloud.your-domain.com',
#  'overwriteprotocol' => 'https',
#
# Also don't forget to add your domain name to the trusted domains array. It should look somewhat like this:
#  array (
#    0 => '192.168.0.1:444', # This line may look different on your setup, don't modify it.
#    1 => 'nextcloud.your-domain.com',
#  ),

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name nextcloud.mydomain.com;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        proxy_pass https://10.100.100.20:444;
        proxy_max_temp_file_size 2048m;
    }
}

 

 

 

 

 

 how do you access that config file? i cant seem to find my copy. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.