Nextcloud version: 21.0.1.1
Operating system and version: Ubuntu 20.04.2
Apache: 2.4.41
PHP version: 7.4.3
Many hits on the _host-prefix issue but no definite hint on the matter. The documentation does not help enough, the messages on the forum also do not give a solution. Maybe many things have to be right to remove it from the result of scan.nextcloud.com.
My configuration:
Nextcloud runs from /var/www/nextcloud
Strato hosts my domain for now I will call it mydomain.com. I have configured the “A-record” to relay traffic to my IP address for this message I say it is 123.123.123. In my router I have forwarded ports 80 and 443 to my NextCloud Server.
Initially I setup a Apache2 config file /etc/apache2/sites-enabled/nextcloud.conf with now has the following content:
---------------------------------------------Start File-----------------------------------------------
Alias /nextcloud “/var/www/nextcloud/”
<VirtualHost *:80>
DocumentRoot “/var/www/nextcloud”
ServerName nextcloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
Satisfy Any
ServerAlias www. mydomain.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =www. mydomain.com [OR]
RewriteCond %{SERVER_NAME} =nextcloud
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
---------------------------------------------End file----------------------------------------------
After installing Letsencript I found /etc/apache2/sites-enabled/nextcloud-le-ssl.conf with the following content:
--------------------------------------------Start File-----------------------------------------------
<VirtualHost *:443>
DocumentRoot “/var/www/nextcloud”
ServerName nextcloud
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
SetEnv HOME /var/www/nextcloud
SetEnv HTTP_HOME /var/www/nextcloud
Satisfy Any
ServerAlias www.inrijen.nl
RewriteEngine on
Some rewrite rules in this file were disabled on your HTTPS site,
because they have the potential to create redirection loops.
RewriteCond %{SERVER_NAME} =www. mydomain.com [OR]
RewriteCond %{SERVER_NAME} =nextcloud
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com /privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
-------------------------------------End file--------------------------------------------
The file /etc/letsencrypt/options-ssl-apache.conf contains the following:
-----------------------------------Start File----------------------------------------------------------
This file contains important security parameters. If you modify this file
manually, Certbot will be unable to automatically provide future security
updates. Instead, Certbot will print and log an error message with a path to
the up-to-date file that you will need to refer to when manually updating
this file.
SSLEngine on
Intermediate configuration, tweak to your needs
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite Text Deleted bij NextCees
SSLHonorCipherOrder on
SSLCompression off
SSLOptions +StrictRequire
Add vhost name to log entries:
LogFormat “%h %l %u %t “%r” %>s %b “%{Referer}i” “%{User-agent}i”” vhost_combined
LogFormat “%v %h %l %u %t “%r” %>s %b” vhost_common
#CustomLog /var/log/apache2/access.log vhost_combined
#LogLevel warn
#ErrorLog /var/log/apache2/error.log
Always ensure Cookies have “Secure” set (JAH 2012/1)
#Header edit Set-Cookie (?i)^(.)(;\ssecure)??((\s*;)?(.*)) “$1; Secure$3$4”
-------------------------------------End File--------------------------------------------------------------
I am very happy with NextCloud and it runs like a champ. How to get rid of the _host-prefix issue? Does anybody have any ideas?