fluxcapacitor Posted January 21, 2021 Share Posted January 21, 2021 (edited) 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? <?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 January 21, 2021 by fluxcapacitor Quote Link to comment
fluxcapacitor Posted January 21, 2021 Author Share Posted January 21, 2021 Bumping for visibility Quote Link to comment
simono5 Posted January 21, 2021 Share Posted January 21, 2021 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. Quote Link to comment
fluxcapacitor Posted January 21, 2021 Author Share Posted January 21, 2021 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. Quote Link to comment
simono5 Posted January 24, 2021 Share Posted January 24, 2021 Sorry I meant on your router. If I remember you forward ports 80 and 443. I forward to 180 and 1443 and set these up in NGINX in the docker container. It's really straight forward and works really reliably. Quote Link to comment
etegration Posted May 14, 2021 Share Posted May 14, 2021 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? <?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. Quote Link to comment
Recommended Posts
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.