Hello Guys i have a problem with https. When I open nextcloud with http local ip or public ip it works, https local ip adres it work but when I try to open it with https public ip it doens’t work. My configuration
1
sudo nano /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
changed too
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
2
sudo mkdir -p /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
3
Country Name (2 letter code) [AU]: pressed enter
State or Province Name (full name) [Some-State]: pressed enter
Locality Name (eg, city) []: pressed enter
Organization Name (eg, company) [Internet Widgits Pty Ltd]: pressed enter
Organizational Unit Name (eg, section) []: pressed enter
Common Name (e.g. server FQDN or YOUR name) []: pressed enter
Email Address []: pressed enter
4
sudo a2enmod ssl
sudo nano /etc/apache2/sites-available/default-ssl.conf
5
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
change to
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
6
sudo a2ensite default-ssl.conf
sudo service apache2 restart
7
sudo nano /etc/apache2/sites-available/000-default.conf
delete everything and added
<VirtualHost :80>
ServerAdmin example@example
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.)$ https://%{HTTP_HOST}$1 [R=301,L]
8
sudo a2enmod rewrite
sudo service apache2 restart
9
sudo nano /var/www/html/nextcloud/config/config.php
’trusted_domains’ =>
array (
0 => ‘192.168.2.20’,
1 => ‘public ip adress’,
3 => ‘public ip adress phone network’,
),
settings:
/var/www/html/nextcloud/config/config.php
overwrite.cli.url => http://192.168.2.20/nextcloud
dbtype mysql
version 12.0.3.3
I installed nextcloud in /var/www/html/nextcloud
portforwarded on my router 443 and 80
when I delete see below http connection nextcloud from public IP works
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
How can I fix it that nextcloud is access able from my public IP adress on https. I tried many things changed overwrite.cli.url from http to https. Changed inside 000-defaults.conf many things.