Connection not secured vhost https redirects to vps default


#1

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 ?


#2

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


#3

I made a pastebin wit the config files

http://pastebin.com/8ybYuYAV


#4

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 )


#5

Might be a .htaccess file. I will have a look at it. But why would it only redirect me when visiting through https:// ?


#6

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


#7

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


#8

This is in the file:

http://pastebin.com/p6fV6PnM


#9

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 :grinning:
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


#10

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.