This script automates the process of generating and installing SSL certificates for XAMPP using OpenSSL.
- XAMPP: Ensure XAMPP is installed on your system.
- Administrator Privileges: The script must be run with administrator privileges to install the generated certificate.
-
Setup Directory:
- Create a directory named
crt
insidexampp/apache/
. - Place the following files from this repository inside
xampp/apache/crt/
:cert-generate.bat
cert-config.conf
- Create a directory named
-
Generate SSL Certificates:
- Open Command Prompt as Administrator.
- Navigate to the directory containing
cert-generate.bat
. - Run the script:
cert-generate.bat
- Follow the prompts to enter the domain details when prompted.
-
Install Certificate:
- After generating the certificates, the script will provide instructions on installation.
- Ensure to install the certificate to Trusted Root Certification Authorities store.
-
Update Hosts File:
- Open
C:\Windows\System32\drivers\etc\hosts
as Administrator. - Add the following line:
127.0.0.1 best.site
- Open
-
Update Apache Configuration:
-
Open
xampp/apache/conf/extra/httpd-vhosts.conf
. -
Add the following VirtualHost configuration (replace
best.site
with your actual domain andbest.site-dir
with your actual directory):## best.site <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/best.site-dir" ServerName best.site ServerAlias *.best.site </VirtualHost> <VirtualHost *:443> DocumentRoot "C:/xampp/htdocs/best.site-dir" ServerName best.site ServerAlias *.best.site SSLEngine on SSLCertificateFile "C:/xampp/apache/crt/best.site/server.crt" SSLCertificateKeyFile "C:/xampp/apache/crt/best.site/server.key" </VirtualHost>
-
-
Restart Apache:
- Restart Apache in XAMPP to apply the configuration changes.
- Administrator Rights: Running
cert-generate.bat
requires administrator rights for certificate installation. - Directory Structure: Ensure the
crt
directory is correctly set up insidexampp/apache/
before running the script.