CentOS给网站配置Https证书
1、在腾讯云申请域名的证书
2、配置文件
安装相应模块:
yum install mod_ssl openssl
编辑配置文件:
cd /etc/httpd/conf.d vi jerryqi.conf
内容如下:
<virtualHost *:80> RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/?(.*) https://%{SERVER_NAME}/ [R,L] </VirtualHost> <VirtualHost *:443> DocumentRoot /var/www/html ServerName jerryqi.cn:443 SSLEngine on SSLProtocol all -SSLv2 SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:!RC4+RSA:+HIGH:+MEDIUM:!LOW:!RC4 SSLCertificateFile /etc/pki/tls/certs/jerryqi.crt SSLCertificateKeyFile /etc/pki/tls/private/jerryqi.key SSLCertificateChainFile /etc/pki/tls/certs/1_root_bundle.crt </VirtualHost>
3、测试并重启服务
sudo service httpd configtest sudo systemctl restart httpd
4、OK
原创文章,转载请注明来源