[Solved] Nextcloud behind Reverse Proxy with SSL termination

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 14.0.1
Operating system and version: Alpine Linux 3.8.0
Nginx version: 1.14.0
PHP version: 7.2

The issue you are facing:
After calling the Nextcloud WebUI http://10.0.0.117/ to complete setup using setup wizard I’m forwarded to this URL:
https://10.0.0.117/login

Then the webbrowser returns this error message:
This site can’t be reached
ERR_CONNECTION_REFUSED

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:
I have not configured SSL on port 443 in Nginx because I will use a reverse proxy (HAproxy 1.8.12) with SSL termination.
This reverse proxy configuration works with several other webservices w/o any problems and therefore I would prefer to continue with this for Nextcloud, too.

My assumption is that Nextcloud forces SSL encryption and forwards to https.

Can I configure Nextcloud to stop using SSL encryption and forwarding to https?

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'datadirectory' => '/var/lib/nextcloud/data',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/usr/share/webapps/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/lib/nextcloud/apps',
      'url' => '/apps-appstore',
      'writable' => true,
    ),
  ),
  'updatechecker' => false,
  'check_for_working_htaccess' => false,
  'installed' => true,
  'instanceid' => 'oce5hcjafbax',
  'passwordsalt' => 'PB0Zunc22giivY+k44xxxxxxxxxxxx',
  'secret' => '/iSwvPdvGDIXoSp/CVFX2SpP74R0og/UeDpgxxxxxxxxxxxx',
  'trusted_domains' =>
  array (
    0 => '10.0.0.117',
  ),
  'dbtype' => 'mysql',
  'version' => '14.0.1.1',
  'overwrite.cli.url' => 'https://10.0.0.117',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nc',
  'dbpassword' => '<my-nc-password>',
);

The output of your Apache/nginx/system log in /var/log/nginx/error.log:

No relevant error recorded.

The output of your Apache/nginx/system log in /var/log/nextcloud/nextcloud.log:

{"reqId":"3jxwwKw8BpJCZVz9WFO2","level":3,"time":"2018-09-27T20:24:44+00:00","remoteAddr":"192.168.1.60","user":"--","app":"PHP","method":"GET","url":"\/","message":"You are using a fallback implementation of the intl extension. Installing the native one is highly recommended instead. at \/usr\/share\/webapps\/nextcloud\/3rdparty\/patchwork\/utf8\/src\/Patchwork\/Utf8\/Bootup\/intl.php#18","userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/69.0.3497.100 Safari\/537.36","version":"14.0.1.1"}

You have an issue with the php-intl package as well. Try fixing that first by installing the correct one for your distro + php version.

Nextcloud will not force https unless you specifically tell it to via your virtualhosts files. So if NC is configured for port 80 it will run there. We do SSL handoff with HAProxy to a NC backend on apache. It works. So unless you specify it, NC aint gonna do it.