Skip to content

Instantly share code, notes, and snippets.

@bathivinod
Last active July 19, 2023 18:05
Show Gist options
  • Select an option

  • Save bathivinod/7bd415d8114197a3797586fec71cd33e to your computer and use it in GitHub Desktop.

Select an option

Save bathivinod/7bd415d8114197a3797586fec71cd33e to your computer and use it in GitHub Desktop.
Create Valid SSL in localhost for XAMPP

Create Valid SSL in localhost for XAMPP

Here’s the step by step guide:

  1. Navigate to Apache directory in XAMPP. eg: C:\xampp\apache

  2. Create a folder in that page This is where we will store our cert. In this example I will create crt folder. So we will have C:\xampp\apache\crt

  3. Add this files cert.conf and make-cert.bat

  4. Push changes to remote repo git push




If you have any questions, do not hesitate to contact me on social media.

Happy coding 😄, --Vinod

GitHub Twitter linkedin

[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
countryName = Country Name (2 letter code)
countryName_default = US
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = NY
localityName = Locality Name (eg, city)
localityName_default = New York
organizationName = Organization Name (eg, company)
organizationName_default = Example, LLC
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_default = {{DOMAIN}}
emailAddress = Email Address
emailAddress_default = test@example.com
[ x509_ext ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment
subjectAltName = @alternate_names
nsComment = "OpenSSL Generated Certificate"
[ req_ext ]
subjectKeyIdentifier = hash
basicConstraints = CA:FALSE
keyUsage = digitalSignature, keyEncipherment
subjectAltName = @alternate_names
nsComment = "OpenSSL Generated Certificate"
[ alternate_names ]
DNS.1 = {{DOMAIN}}
@echo off
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
if not exist .\%domain% mkdir .\%domain%
..\bin\openssl req -config cert.conf -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 3650 -out %domain%\server.crt
echo.
echo -----
echo The certificate was provided.
echo.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment