首先,在terminal上使用以下命令获取localhost.csr,localhost.key和localhost.crt:
请求:
openssl req -new -newkey rsa:2048 -nodes -keyout localhost.key -out localhost.csr
证书:
openssl x509 -req -days 365 -in localhost.csr -signkey localhost.key -out localhost.crt
我在这里跟着这个问题,并在httpd-ssl.conf上更新这些directives
:
SSLCertificateKeyFile "/Applications/XAMPP/xamppfiles/apache2/ssl-certs/localhost.key" SSLCertificateFile "/Applications/XAMPP/xamppfiles/apache2/ssl-certs/localhost.crt"
在MyApache中,启用了SSL。 当我重新启动本地主机,并转到http://localhost
,绿色标志出现,但我得到:
Access Forbidden Error 403 You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
如果我使用普通的http://localhost
,网站加载正常。
有什么问题? 使用http://
加载,但不使用https://
?