Tips and tricks on developing web sites

httpd-vhosts.conf for SSL Sites

Apache is wonderful in that it can host numerous sites at the same time. The logic for those sites is stored in C:\xampp\apache\conf\httpd-vhosts.conf. To point Apache at https://example.com, add this configuration. Remember that you must have made the SLL certificates first. XAMPP has conveniently done this for you already. Be sure to change the first line to port 443 instead of 80.

<VirtualHost *:443>
    ServerAdmin info@example.com
    DocumentRoot "C:/xampp/htdocs/public_html"
    ServerName example.com
    ServerAlias www.example.com
    ErrorLog "logs/example.com-error.log"
    CustomLog "logs/example.com-access.log" common
    SSLEngine on
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>

If you are using an add-on domain, it would be:

<VirtualHost *:443>
    ServerAdmin info@example.com
    DocumentRoot "C:/xampp/htdocs/public_html"
    ServerName example.com
    ServerAlias www.example.com
    ErrorLog "logs/example.com-error.log"
    CustomLog "logs/example.com-access.log" common
    SSLEngine on
    SSLCertificateFile "conf/ssl.crt/server.crt"
    SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>

Your browser will complain about an Invalid certificate authority when you go to https://example.com in your browser. That’s correct, it is an invalid authority. You can still bypass that warning though, and Proceed to the site.