Skip to content

Instantly share code, notes, and snippets.

@Tynael
Last active February 14, 2024 13:19
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tynael/d3a647c71bb00f0442590e6d91285a4e to your computer and use it in GitHub Desktop.
Save Tynael/d3a647c71bb00f0442590e6d91285a4e to your computer and use it in GitHub Desktop.
How to Set up an SSL Certificate in Localhost for XAMPP

How to Set up an SSL Certificate in Localhost for XAMPP

These files represent the content that has been modified during the tutorial.

To better understand the context, go through the video and/or written tutorial.

# xampp/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName localvaren.com
ServerAlias localvaren.com
DocumentRoot "G:/xampp/htdocs/varen/public"
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.localvaren.com [OR]
RewriteCond %{SERVER_NAME} =localvaren.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
ServerName localvaren.com
ServerAlias localvaren.com
DocumentRoot "G:/xampp/htdocs/varen/public"
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
</VirtualHost>
# xampp/apache/conf/httpd.conf
# The following lines must be uncommented. Remove the preceeding "#".
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf
...
bin\openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 1825 -extfile v3.ext
...
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
DNS.2 = *.localvaren.com
DNS.3 = localvaren.com
DNS.4 = 127.0.0.1
DNS.5 = 127.0.0.2
@McPherson49
Copy link

Thank you for this information. it really worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment