I'm trying to generate a valid SSL certificate for running a website on my machine locally.
I've followed every tutorial I can find but every time I make a certificate using makecert.bat, Chrome and Edge tell me the certificate is invalid.
Does this batch file still work or is it outdated?
My site is located at https://mysite.local
In my hosts file I have....
127.0.0.1 mysite.local
127.0.0.1 www.mysite.local
In my httpd-vhosts.conf file I have:
<VirtualHost *:80>
ServerName mysite.local
ServerAlias www.mysite.local
DocumentRoot "C:/Projects/MySite/source/httpdocs"
<Directory "C:/Projects/MySite/source/httpdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName mysite.local
ServerAlias www.mysite.local
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
DocumentRoot "C:/Projects/MySite/source/httpdocs"
<Directory "C:/Projects/MySite/source/httpdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
So, when I run makecert.bat do I use mysite.local as my common name?
Edit 1
As pointed out, I didn't supply enough detail, so these are the steps I've taken so far:
- Run makecert.bat
- Entered PEM pass phrase (twice)
- Entered GB as Country Name
- Entered nothing (just pressed ENTER) for State or province name, Locality name, Organization name, Organisational Unit
- Entered mysite.local for Common Name
- Entered nothing (just pressed ENTER) for Email address, Challenger password, Company name
- Entered same passphrase as in step 2
After the certificate was generated....
- I ran certificate manager
- Double clik Trusted Root Certification Authorities
- Right click Certificates & select All Tasks->Import
- Click Next (Local Machine defaulted)
- Browsed to C:\xampp\apache\conf\ssl.crt\server.crt & clicked Next
- Clicked Next (defaulted to Place certificate in Trusted Root Certification Authorities)
- Clicked Finish
Now start Xampp Apache and browse to https://mysite.local
Edit 2
The actual error I see is NET::ERR_CERT_COMMON_NAME_INVALID
I've created a certificate for the following but get the same error each time.
mysite
mysite.local
www.mysite.local