Having issues with multi virtual hosts with ssl

In the first run my first virtual host was successfully running well with SSL however when I tried to do it on second one it is not working anymore First I edit apache httpd-xampp.conf and added this, So basically based on this article: Using Multiple SSL Certificates in Apache with One IP Address

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/proteksyon"
    ServerAdmin admin@proteksyon.ph
    ServerName proteksyon.ph
    ServerAlias *.proteksyon.ph
    SSLEngine On
    SSLCertificateFile "crt/proteksyon.ph/server.crt"
    SSLCertificateKeyFile "crt/proteksyon.ph/server.key"
    <Directory "C:/xampp/htdocs/proteksyon">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost *:443>
    DocumentRoot "C:/xampp/htdocs/proteksyon"
    ServerAdmin admin@proteksyon.ph
    ServerName proteksyon.ph
    ServerAlias *.proteksyon.ph
    SSLEngine On
    SSLCertificateFile "crt/proteksyon.ph/server.crt"
    SSLCertificateKeyFile "crt/proteksyon.ph/server.key"
    <Directory "C:/xampp/htdocs/proteksyon">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/clique"
    ServerAdmin support@clique.me
    ServerName clique.me
    ServerAlias clique.me
    SSLEngine On
    SSLCertificateFile "crt/clique.me/server.crt"
    SSLCertificateKeyFile "crt/clique.me/server.key"
    <Directory "C:/xampp/htdocs/clique">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>
<VirtualHost *:443>
    DocumentRoot "C:/xampp/htdocs/clique"
    ServerAdmin support@clique.me
    ServerName clique.me
    ServerAlias clique.me
    SSLEngine On
    SSLCertificateFile "crt/clique.me/server.crt"
    SSLCertificateKeyFile "crt/clique.me/server.key"
    <Directory "C:/xampp/htdocs/clique">
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

And this is the inputs for my hosts file:

127.0.0.1 clique.me
127.0.0.1 proteksyon.ph

When accessing the proteksyon.ph everything is good and SSL is working fine it access the file of proteksyon and htdocs. When it comes to accessing/browsing the clique.me it throw this kind of error: enter image description here

1 answer

  • answered 2022-05-07 23:20 Mashwishi

    The problem appears to be that I am trying to use SSL on port 80, which is exclusively for HTTP, not HTTPS. I want my website to always be served via HTTPS, then you can redirect to the HTTPS version instead:

    <VirtualHost *:80>
        ServerName clique.me
        Redirect permanent / https://clique.me/
    </VirtualHost>
    <VirtualHost *:443>
        DocumentRoot "C:/xampp/htdocs/clique"
        ServerAdmin support@clique.me
        ServerName clique.me
        SSLEngine On
        SSLCertificateFile "crt/clique.me/server.crt"
        SSLCertificateKeyFile "crt/clique.me/server.key"
        <Directory "C:/xampp/htdocs/clique">
            AllowOverride All
            Order Allow,Deny
            Allow from all
            Require all granted
        </Directory>
    </VirtualHost>
    

    The same also applied on proteksyon.ph as well.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum