- Instant help with your Developer coding problems

Setup HTTPS for local development on Windows 10

Question:
How to setup HTTPS for local development on Windows 10?
Answer:
openssl req -x509 -nodes -new -sha256 -days 1024 -newkey rsa:2048 -keyout RootCA.key -out RootCA.pem -subj "/C=US/ST=NY/L=New York/O=0 Local Development/OU=IT/CN=0 Local Development/emailAddress=info@local.dev"

openssl x509 -outform pem -in RootCA.pem -out RootCA.crt

openssl req -new -nodes -newkey rsa:2048 -keyout ssltest.dev.key -out ssltest.dev.csr -subj "/C=US/ST=NY/L=New York/O=Local Developer/OU=IT/CN=ssltest.dev/emailAddress=info@ssltest.dev"

openssl x509 -req -sha256 -days 1024 -in ssltest.dev.csr -CA RootCA.pem -CAkey RootCA.key -CAcreateserial -extfile ssltest.ext -out ssltest.dev.crt
Description:

First, create the root certificate and install the RootCA.crt file (right-click -> Install Certificate) to Trusted Root Certification Authorities .

Next, create a certificate for the domain. In this example the ssltest.dev is the local test domain.

The ssltest.ext file content should look like this:

authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names

[alt_names]
DNS.1 = localhost
DNS.2 = ssltest.dev

 

Reference:
OpenSSL reference
Share "How to setup HTTPS for local development on Windows 10?"
Tags:
local ssl certificate, local https, windows, apache
Technical term:
Setup HTTPS for local development on Windows 10