Appliance disable https redirect

Hello,

I just installed the appliance and https was automatically enabled. How can I disable it, or just remove the redirect? I checked under apache2/sites-available and .htaccess but don’t see the option.

Thank you!

Hello @sahara.

Welcome in Nextcloud community !!

Have you tried :
a2dismod ssl
remove the line Redirect permanent \ your.ip.com in your config file (http).
and sudo systemctl restart apache2

Bye :slight_smile:

1 Like

Got the same Problem.
Installed the VMWare VM.
Everything is working smooth etc.
@didi44 I looked up and could not find a " Redirect permanent" in /var/www/nextcloud/config/config.php:

<?php
$CONFIG = array (
  'passwordsalt' => '*********',
  'secret' => '*********',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '192.168.1.234',
    2 => 'nextcloud',
    3 => '*********',
  ),
  'datadirectory' => '/mnt/ncdata',
  'dbtype' => 'pgsql',
  'version' => '20.0.7.1',
  'overwrite.cli.url' => 'https://nextcloud/',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '*********',
  'dbpassword' => '*********',
  'installed' => true,
  'instanceid' => '*********',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'log.condition' =>
  array (
    'apps' =>
    array (
      0 => 'admin_audit',
    ),
  ),
  'mail_smtpmode' => 'smtp',
  'logtimezone' => 'Etc/UTC',
  'maintenance' => false,
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '*********',
  'mail_domain' => '*********',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
);

As far as I can see it, The VM is based on Ubuntu…
@sahara did you find out how?

Thanks in Advance

Hello @May!

Welcome to the Nextcloud community!

It’s normal!

You have to add it in the server conf file and not in nextcloud.conf !

An example with Apache :

<VirtualHost *:80>
   ServerName cloud.nextcloud.com
   Redirect permanent / https://cloud.nextcloud.com/
</VirtualHost>

If you are using Apache, the path is /etc/apache2/sites-available/xxx.conf.

The official documentation Hardening and security guidance — Nextcloud latest Administration Manual latest documentation

Please, let me know if you have any questions.

1 Like

Thanks for the clarification,

but you stated before that the line Redirect permanent in /etc/apache2/sites-available/xxx.conf should be removed (I think you meant that).
…I found 4 .conf Files and none of them has a Redirect permanent variable :

000-default.conf, nextcloud_http_domain_self_signed.conf, default-ssl.conf, nextcloud_tls_domain_self_signed.conf.

I Uploaded them in https://github.com/The-May/configdump (The code always messed up the formatting here…)

Only thing what I vaguely might think that could be doing the redirect is following in nextcloud_http_domain_self_signed.conf:

<VirtualHost *:80>
 RewriteEngine On
 RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]

Any help is very appreciated.

Hi @The-May !

How did you install Nextcloud? Did you follow a tutorial? Because the files are not the same as the official documentation, but it works too :slight_smile:

Yes you can try to disable the conf with : a2dismod nextcloud_http_domain_self_signed.conf
and connect to your server in a private window.

1 Like

Like i said: I used the official VM Image with VMWare Workstation Player


Only thing I changed were Things via GUI (Apps etc) and the Trusted Domains

I will try it out today and keep you updated! Thanks in advance for the a2dismod nextcloud_http_domain_self_signed.conf command!

@didi44 it did not work unfortunately…

config was
nextcloud_tls_domain_self_signed.conf
and not
nextcloud_http_domain_self_signed.conf (my bad)

<VirtualHost *:80>

RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST} [R=301,L]

Nevertheless sudo a2dismod nextcloud_tls_domain_self_signed.conf did not work at all
Errormessage:
ERROR: Module nextcloud_tls_domain_self_signed.conf does not exist!

Hi !

I’m sorry ! It’s my fault :slight_smile:

It’s a2dissite not a2dismod :slight_smile:

Don’t forget : sudo systemctl restart apache2

1 Like

Hi !

I downloaded Nextcloud’s VM and managed to disable https.

First of all disable all Apache configurations with a2dissite (not a2dismod :)) <ConfFile.conf>
Normally a2dissite *.conf works.

The directory /etc/apache2/site-enable/ should be empty. Check it.

You can enable the nextcloud_http_domain_self_signed.conf conf with a2ensite nextcloud_http_domain_self_signed.conf.

And edit the config.php in /var/www/nextcloud/config/config.php and comment the line : 'overwrite.cli.url' => 'https://nextcloud/',

Apply the configuration with sudo systemctl restart apache2.

Try to connect to your server from a private window and it works normally.

1 Like

First of all disable all Apache configurations with a2dissite (not a2dismod :)) <ConfFile.conf>
Normally a2dissite *.conf works.

did sudo a2dissite *.conf . :white_check_mark:

The directory /etc/apache2/site-enable/ should be empty. Check it.

ls /etc/apache2/sites-enabled gave me nothing, even did sudo, therefore empty. :white_check_mark:

You can enable the nextcloud_http_domain_self_signed.conf conf with a2ensite nextcloud_http_domain_self_signed.conf.

sudo a2ensite nextcloud_http_domain_self_signed.conf
has been run without any problems :white_check_mark:

sudo nano /var/www/nextcloud/config/config.php

commented out by adding a // :white_check_mark:

grafik

ran sudo systemctl restart apache2 without an error :white_check_mark:

Did a full sudo restart to be sure :white_check_mark:

after that I tried it out: http://local.ip.to.nextcloud redirects me to https://local.ip.to.nextcloud, leading me to an SSL Error
BUT using http://nextcloud did the trick which works fine for me though.

Merci beaucoup mon ami!

1 Like

I’m having an issue with this too. Running Nextcloud in a Turnkey Container. I tried to enable self signed cert with:

a2enmod ssl
a2ensite default-ssl
service apache2 reload

After doing this I can no longer access my Nextcloud. I just get this screen:
Gmail Screenshot by cloudHQ 3_23_2021 6_02_59 AM

I’ve tried with http, https, my local ip and my dns name. Used to work with both my ip and dns name.
I followed all your steps to try to get it back. Do you have any suggestions for me to try?

Hi !

a2dismod ssl
a2dissite default-ssl
service apache2 reload

It doesn’t work?

Sooo… apparently when you try that on a NextCloudPi you kill it…

I tried @didi44 instructions from Feb. '21 and as soon as i a2dissite *.conf in the /etc/apache2/sites-available folder i killed my cloud. I surely tried the opposite a2ensite *.conf but it didn’t change. FYI: the Folder sites-enable wasn’t empty after that.

I access my cloud over its local ip: 192.168.0.10
Trying https://192.168.0.10/login i get a “URL not found”
Trying http://192.168.0.10/login i do get to the login screen but after logging in it redirects me to https://192.168.0.10/apps/files/ and i again get a “URL not found”…

So yeah i could use some help fixing that mess :smiley:

Hi @An0nym0us_Dr0ne :upside_down_face:

Can you run the command : ls /etc/apache2/sites-available and return us the output please.

Sure!

root@nextcloudpi:/home/pi# ls /etc/apache2/sites-available
000-default.conf  default-ssl.conf  ncp-activation.conf  ncp.conf  nextcloud.conf

Thank you @An0nym0us_Dr0ne .

What are the ncp-activation.conf and ncp.conf files?

Where is your Nextcloud configuration folder?

I think that when you tried a2dissite *.conf you disabled your Apache configuration for Nextcloud and with a2ensite *.conf conflicts appeared, as the files are not correctly configured.

Does your Raspberry Pi only serve Nextcloud? or other websites too.

It feels like that’s exactly what happened. Like i enabled to much and its shooting each other down.

I only run Nextcloud on it. In fact i use the NextcloudPi OS for that.

I don’t know what those files do but i can provide the code for you.

ncp-activation.conf:

ncp.conf:

Ok I never try NextcloudPi OS, have you added some Apache config files ?

Added? No. I tried deleting (aka. commenting) stuff in order to disable https but i added nothing.