LinuxServer.io Nextcloud on Plain HTTP

Miris

[2022-03-08 Tue]

THIS SHOULD BE DONE AS AN ABSOLUTE A LAST RESORT AWAY FROM PRODUCTION/PUBLIC SERVICES!

The LinuxServer.io Nextcloud Docker Container enforces HTTPS by default. It's a completely sane and recommended choice which shouldn't be changed; however, some people want to run Nextcloud on plain HTTP.

If you're one of those people, all you need to do is edit the two following files:

# nginx configuration
/config/nginx/site-confs/default

# nextcloud configuration
/config/www/nextcloud/config/config.php

For NGINX, simply delete the SSL-related declarations:

# /config/nginx/site-confs/default
@@ -5,14 +5,6 @@
     listen 80;
     listen [::]:80;
     server_name _;
-    return 301 https://$host$request_uri;
-}
-server {
-    listen 443 ssl http2;
-    listen [::]:443 ssl http2;
-    server_name _;
-    ssl_certificate /config/keys/cert.crt;
-    ssl_certificate_key /config/keys/cert.key;

     # Add headers to serve security related headers
     # Before enabling Strict-Transport-Security headers please read into this

As for Nextcloud, declare the following variable:

# /config/www/nextcloud/config/config.php
@@ -13,4 +13,5 @@
   'version' => '23.0.2.1',
   'overwrite.cli.url' => 'http://nextcloud.localhost',
   'installed' => true,
+  'overwriteprotocol' => 'http',
 );

Once again, you should use this as a last resort. The developers - much to some people's dismay - are against implementing no-SSL as an option for the container, and understandably so! It's an unnecessary compromise of security, especially when acquiring an SSL certificate is easier than ever.

I offered the solution for the sake of sharing the answer to a commonly-asked question, but I absolutely don't condone using it.