I am using Certbot/Letsencrypt on my own VPS to add an extra layer of security to my websites (http --> https).
Problem
When I visit the link http://subdomain.example.nl
, I get the following error:
This site can't be reached (DNS_PROBE_FINISHED_NXDOMAIN)
as it tries to reach https://subdomain.%24servame
(this is what I find in my url bar)
www.example.nl
results in https://%24servame/
So I think there is something wrong in my Apache2 config (sites-available) files.
What I tried
Basically nothing yet, as I'm afraid to mess it up even more. It is a live website, and via the https:// directly it works (basically how people get to there anyways, as they just click a link). So it works. But when I quickly try to type the link in a chat, it won't work. I need to make sure people can share this link by memory if they have to.
I sincerely hope somebody can spot something wrong in my file. I googled this issue, but i can't seem to find anything relevant.
Apache config
subdomain.example.nl.conf
<VirtualHost *:80>
ServerAdmin webmaster@example.nl
DocumentRoot /var/www/example.nl/www/webroot
ServerName subdomain.example.nl
<Directory /var/www/example.nl/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/www.example.nl.error.log
CustomLog ${APACHE_LOG_DIR}/www.example.nl.access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =subdomain.example.nl
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
subdomain.example.nl-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@example.nl
DocumentRoot /var/www/example.nl/www/webroot
ServerName subdomain.example.nl
<Directory /var/www/example.nl/www>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order allow,deny
allow from all
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/www.example.nl.error.log
CustomLog ${APACHE_LOG_DIR}/www.example.nl.access.log combined
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} =subdomain.example.nl
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
SSLCertificateFile /etc/letsencrypt/live/subdomain.example.nl/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/subdomain.example.nl/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
I asked my question at serverfault as well, but since I'm with my hands in my hair I'm posting it here as well.