20241105 APACHE2 免费SSL证书
背景意义,自签证书访问需要额外点击访问
证书>申请证书>填写证书>勾选泛域名支持>选择合适的验证方式>坐等验证通过
下载证书,部署
nano /etc/apache2/sites-available/default-ssl.conf
SSLCertificateFile /path/fullchain.crt
fullchain.crt: 证书和证书链
SSLCertificateKeyFile /path/private.pem
private.pem: 密钥(请妥善保存)
例如
root@Hinlink:/etc/apache2/sites-available# cat default-ssl.conf
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/fullchain.crt
SSLCertificateKeyFile /etc/apache2/ssl/private.pem
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
</VirtualHost>
重启服务
service apache2 restart