How To Config Multiple ssl in xampp

 in this xampp ssl tutorial i will show to you How To Config Multiple ssl in xampp using httpd-vhosts.conf and httpd-ssl.conf you will find this files in this directory : xampp/apache/conf/extra

Before start Plz save all your xampp folder .

Lets Start This Xampp Tutorial 2022 :

You can see i have 2 root one is htdocs and the other root is htdocs2

First we have 2 ssl Websites installed :

 1)www.example1.com installed on C:/xampp/htdocs
1) i make a folder  ” ssl ” and i past my ssl crt and key files for the website number 1 (www.example1.com)
C:/xampp/htdocs/ssl/server.crt
C:/xampp/htdocs/ssl/server.key
2)www.example2.com installed on C:/xampp/htdocs2
2) next i make a folder  “ssl” and i past my ssl crt and key files for the website number 2 (www.example2.com)
C:/xampp/htdocs2/ssl/server.crt
C:/xampp/htdocs2/ssl/server.key

The code httpd-ssl.conf will look like this :


Listen 443


SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES


SSLHonorCipherOrder on 


SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3


SSLPassPhraseDialog  builtin


SSLSessionCache "shmcb:C:/xampp/apache/logs/ssl_scache(512000)"
SSLSessionCacheTimeout  300

<VirtualHost _default_:443>


DocumentRoot "C:/xampp/htdocs"
ServerName www.example1.com:443
ServerAdmin admin@example.com

SSLEngine on


SSLCertificateFile "C:/xampp/htdocs/ssl/server.crt"

SSLCertificateKeyFile "C:/xampp/htdocs/ssl/server.key"



<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars

<Directory "C:/xampp/apache/cgi-bin">
    SSLOptions +StdEnvVars



BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    #CustomLog "logs/ssl_request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
#CustomLog "C:/xampp/apache/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

                                  

DocumentRoot "C:/xampp/htdocs2"
ServerName www.www.example2.com:443
ServerAdmin admin@example.com

SSLEngine on


SSLCertificateFile "C:/xampp/htdocs2/ssl/server.crt"

SSLCertificateKeyFile "C:/xampp/htdocs2/ssl/server.key"



<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars

<Directory "C:/xampp/apache/cgi-bin">
    SSLOptions +StdEnvVars



BrowserMatch ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
    #CustomLog "logs/ssl_request.log" "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
#CustomLog "C:/xampp/apache/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

   </VirtualHost>

 next edit with your sites urls save it and go to the next step

again go to C:\xampp\apache\conf\extra

 next edit this File httpd-ssl.conf remplace www.example.com with your website url and your root folders and ssl folders names  :



<VirtualHost *:80>
ServerAdmin example1.com
DocumentRoot "C:/xampp/htdocs"
ServerName example1.com
ServerAlias www.example1.com

</VirtualHost>

<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs"
ServerName example1.com
SSLEngine on
SSLCertificateFile "C:/xampp/htdocs/ssl/server.crt"
SSLCertificateKeyFile "C:/xampp/htdocs/ssl/server.key"
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
</VirtualHost>

 

<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs2/"
ServerName example2.com
ServerAlias www.example2.com
</VirtualHost>

<VirtualHost *:443>
DocumentRoot "C:/xampp/htdocs2/"
ServerName example2.com
SSLEngine on
SSLCertificateFile "C:/xampp/htdocs2/ssl/server.crt"
SSLCertificateKeyFile "C:/xampp/htdocs2/ssl/server.key"
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
</VirtualHost>


Edit This Lines With Your Info :

For Site Number 1 :

<VirtualHost *:80>
ServerAdmin example1.com
DocumentRoot “C:/xampp/htdocs”
ServerName example1.com
ServerAlias www.example1.com

</VirtualHost>

<VirtualHost *:443>
DocumentRoot “C:/xampp/htdocs”
ServerName example1.com
SSLEngine on
SSLCertificateFile “C:/xampp/htdocs/ssl/server.crt”
SSLCertificateKeyFile “C:/xampp/htdocs/ssl/server.key”
Header always set Strict-Transport-Security “max-age=63072000; includeSubDomains”
</VirtualHost>

in the same way for Site Number 2 :

<VirtualHost *:80>
DocumentRoot “C:/xampp/htdocs2/”
ServerName example2.com
ServerAlias www.example2.com
</VirtualHost>

<VirtualHost *:443>
DocumentRoot “C:/xampp/htdocs2/”
ServerName example2.com
SSLEngine on
SSLCertificateFile “C:/xampp/htdocs2/ssl/server.crt”
SSLCertificateKeyFile “C:/xampp/htdocs2/ssl/server.key”
Header always set Strict-Transport-Security “max-age=63072000; includeSubDomains”
</VirtualHost>

Save All

if you want to connect to phpmyadmin you can do it from your first website www.ecample1.com/phpmyadmin no need to config for the ecample2.com web site becose it will work fine if not you can edit by editing httpd-xampp.conf

Alias /phpmyadmin “C:/xampp/phpMyAdmin/”
<Directory “C:/xampp/phpMyAdmin”>
AllowOverride AuthConfig
Require local

ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>

Alias /webalizer “C:/xampp/webalizer/”
<Directory “C:/xampp/webalizer”>
<IfModule php7_module>
<Files “webalizer.php”>
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
</IfModule>

finally Save and Enjoy XAMPP Apache with multiple SSL hosts issue fixed

also if you have any error or your apache dont start just verify if you added you ssl files in the right place and test again.

also you can cheek your error logs for example it can be the root or the ssl folder you will find out just by looking the number of the error line .

than if you dont have an ssl you can have one for free from this link https://s-educatetools.com/free-ssl-certificate-2022/