Hello, I managed to create a certificate for a vhost on my VPS. Visiting the url results in a redirection to the VPS ip address and the massage Connection not secured, so no connection made with this website.
I manually created the vhosts for both the *80 and *443 ports. which are working.
running the test:
https://www.ssllabs.com/ssltest/analyze.html?d=www.menesmooiste.nl seems to be ok?
I ran this: to get the desired result:
certbot --apache -w /var/www/ -w /var/www/www.menesmooiste.nl/www/html -d www.menesmooiste.nl
My VPS set-up is meant to be like this:
the base dir/default: the vps ip address (serving a test environment) (var/www)
www.menesmooiste.nl</> (var/www//var/www/www.menesmooiste.nl/www/html
other domain.com</>(/var/www/www.domain.com/www/html)
etc.
this is in My
<VirtualHost *:443>
DocumentRoot "/var/www/www.menesmooiste.nl/www/html"
ServerName www.menesmooiste.nl
ServerAlias menesmooiste.nl www.menesmooiste.nl
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/www.menesmooiste.nl/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.menesmooiste.nl/privkey.pem
<Directory “/var/www/www.menesmooiste.nl/www/html”>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride all
How to get this working properly for https://www.menesmooiste.nl ?
Can you paste your complete vhost config for the domain (pastebiin.com is probably the best place ) and also for you default ssl.conf
It looks as if apache is not correctly determining the right vhost
I made a pastebin wit the config files
vhost setting ssl - Pastebin.com
Thanks, most of that looks OK. Do you have a .htaccess file in /var/www/www.menesmooiste.nl/www/html/.htaccess that has redirects in ?
If not - is it a specific web application code you are using for the website ? if so what ? and is there a config section (don’t post that though, as it will generally contain private information )
Might be a .htaccess file. I will have a look at it. But why would it only redirect me when visiting through https:// ?
this is a part out of the .htaccess file:
############################################
make HTTPS env vars available for CGI mode
SSLOptions StdEnvVars
############################################
enable rewrites
Options +FollowSymLinks
RewriteEngine on
############################################
you can put here your magento root folder
path relative to web root
RewriteBase /
The Rewrite base could be the one disturbing? Than again when visiting the http: page it does not redirect to the server ip address
RewriteBase on it’s own won’t cause the effects you are seeing … was there anything after it in the file ?
You will also need to probably go into your magento config and change that
Seems that I got it working now. In Magento2 I had to set the “secure base url” Now https:// is leading to the right domain. Nice 
I also use this for e-mail purposes (Postfix and Dovecot) and it seems to work. Although it also says that the domain name on the certificate does not match with the domain visit ?). Just accepting the certificate and off you go.
Thanks for the help