Hello community,
I’m having trouble configuring my new subdomain name correctly on Apache2/Archlinux VPS.
I have a domain name called example.org that points on /srv/http/.
I also have a subdomain name (DNS entry A) called nextcloud.example.org that I would like to point on my nextcloud folder “/usr/share/webapps/nextcloud/”.
I can currently get access to nextcloud via an alias : example.org/nextcloud/, but not with the new subdomain name. My browser says “bad redirection”.
My config files :
# /etc/httpd/conf/extra/nextcloud.conf
Alias /nextcloud "/usr/share/webapps/nextcloud/"
<Directory /usr/share/webapps/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
<VirtualHost *:80>
Redirect permanent / https://nextcloud.example.org/
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "/usr/share/webapps/nextcloud/"
ServerName nextcloud.example.org
ErrorLog /var/log/httpd/nextcloud.info-error_log
CustomLog /var/log/httpd/nextcloud.info-access_log common
<Directory /usr/share/webapps/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =nextcloud.example.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# /etc/httpd/conf/extra/httpd-vhosts.conf
# generated 2020-09-28, Mozilla Guideline v5.6, Apache 2.4.41, OpenSSL 1.1.1d, modern configuration
# https://ssl-config.mozilla.org/#server=apache&version=2.4.41&config=modern&openssl=1.1.1d&guideline=5.6
# this configuration requires mod_ssl, mod_socache_shmcb, mod_rewrite, and mod_headers
<VirtualHost *:80>
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerAdmin example@example.org
DocumentRoot "/srv/http"
ServerName example.org
ServerAlias www.example.org
ErrorLog "/var/log/httpd/example.org-error_log"
CustomLog "/var/log/httpd/example.org-access_log" common
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.org-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.org-0001/privkey.pem
SSLEngine on
# enable HTTP/2, if available
Protocols h2 http/1.1
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
Header always set Strict-Transport-Security "max-age=63072000"
</VirtualHost>
# modern configuration
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1 -TLSv1.2
SSLHonorCipherOrder off
SSLSessionTickets off
SSLUseStapling On
SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
Is something wrong with my config files? It worked for a while but I tried to follow all the security recommandations (activating https etc.) on nextcloud guidelines, that’s when my subdomain name messed up.
Thank you for your help.