apache2配置https
首先需要证书,可以看我另一篇关于openssl颁发证书的blog
配置https
vim /etc/apache2/site-avaiable/default-ssl.conf
SSLCertificateFile /ssl/skills.crt
SSLCertificateKeyFile /ssl/skills.key
SSLCACertificateFile /ssl/cacert.crt
root@Server01:~
Enabling site default-ssl.
To activate the new configuration, you need to run:
systemctl reload apache2
root@Server01:~
root@Server01:~
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
systemctl restart apache2
systemctl srestart apache2
配置使用http访问时自动跳转https
root@Server04:~
redirect permanent "/" "https://www.skills.com"
systemctl restart apache2
浏览器访问https站点不提示安全警告
|