假设XAMPP安装目录为:H:\_xampp
1、配置 C:\Windows\System32\drivers\etc\hosts
127.0.0.1 test.com 127.0.0.1 www.test.com
2、下载证书,复制到 H:\_xampp\apache\conf
3、修改 httpd-ssl.conf 添加端口
Listen 8443
4、修改 H:\_xampp\apache\conf\extra\httpd-vhosts.conf 添加网站路径
NameVirtualHost *:8443 <VirtualHost *:8443> ServerName localhost DocumentRoot H:\_xampp\htdocs\test SSLEngine on SSLProxyEngine on SSLCertificateFile "H:\_xampp\apache\conf\key\server.crt" SSLCertificateKeyFile "H:\_xampp\apache\conf\key\server.key" <Directory "/"> Options None AllowOverride All Order allow,deny Allow From All </Directory> </VirtualHost>
5、重启 Apache
6、访问 https://www.test.com:8443/