Localhost (HTTPS) certificate on your Webserver XAMPP Working 100%
1. Create important files
Go to apache folder then create a folder name what ever you want but to easy to notice you should create it name "cert"Then go inside the cert folder and create two files below:
makecert.bat (put this content and save)
@echo offset /p domain="Enter Domain: "set OPENSSL_CONF=../conf/openssl.cnfif not exist .\%domain% mkdir .\%domain%..\bin\openssl req -config cert.conf -new -sha256-newkey rsa:2048 -nodes -keyout %domain%\server.key -x509-days 365 -out %domain%\server.crtecho.echo -----echo The certificate was provided.echo.pause
cert.conf (put this content and change laravelpro.local to your domain name and save)
[ req ]default_bits = 2048default_keyfile = server-key.pemdistinguished_name = subjectreq_extensions = req_extx509_extensions = x509_extstring_mask = utf8only[ subject ]countryName = Country Name (2 letter code)countryName_default = USstateOrProvinceName = State or Province Name (full name)stateOrProvinceName_default = NYlocalityName = Locality Name (eg, city)localityName_default = New YorkorganizationName = Organization Name (eg, company)organizationName_default = Example, LLCcommonName = Common Name (e.g. server FQDN or YOUR name)commonName_default = laravelpro.localemailAddress = Email AddressemailAddress_default = test@example.com[ x509_ext ]subjectKeyIdentifier = hashauthorityKeyIdentifier = keyid,issuerbasicConstraints = CA:FALSEkeyUsage = digitalSignature, keyEnciphermentsubjectAltName = @alternate_namesnsComment = "OpenSSL Generated Certificate"[ req_ext ]subjectKeyIdentifier = hashbasicConstraints = CA:FALSEkeyUsage = digitalSignature, keyEnciphermentsubjectAltName = @alternate_namesnsComment = "OpenSSL Generated Certificate"[ alternate_names ]DNS.1 = laravelpro.local
2. Generate cert
Double click to run makecert.bat and fill your domain info (Enter your domain name on Common Name)
After done this you will have a cert folder that its name is your domain name
And inside this folder you can see two files has been generated (server.crt, server.key)
3. Install server.crt
Double click on it then click on install certificate4. Create and config virtual host
Edit file httpd-vhosts.conf from folder (apache\conf\extra) and input following text and replace ServerName, DocumentRoot, Directory to your domain
Example:
<VirtualHost *:80>DocumentRoot "S:\Laravels\Projects\laravelPro\public"ServerName laravelPro.local<Directory "S:\Laravels\Projects\laravelPro\public">Options Indexes FollowSymLinks MultiViewsAllowOverride allOrder Deny,AllowAllow from allRequire all granted</Directory></VirtualHost><VirtualHost *:443>DocumentRoot "S:\Laravels\Projects\laravelPro\public"ServerName laravelPro.localSSLEngine OnSSLCertificateFile "D:\XAMPP\apache\cert\laravelpro.local\server.crt"SSLCertificateKeyFile "D:\XAMPP\apache\cert\laravelpro.local\server.key"<Directory "S:\Laravels\Projects\laravelPro\public">Options Indexes FollowSymLinks MultiViewsAllowOverride allOrder Deny,AllowAllow from allRequire all granted</Directory></VirtualHost>
Add your server name to hosts. Go to (C:\Windows\System32\drivers\etc) then you can see file hosts. Edit and add your server/domain name.
Example
Now everything are done please restart your apache and try https