CentOS給網站配置Https證書

一、在騰訊雲申請域名的證書

二、配置文件

安裝相應模塊:html

yum install mod_ssl openssl 

編輯配置文件:測試

cd /etc/httpd/conf.d
vi jerryqi.conf 

內容以下:ui

<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> 

三、測試並重啓服務

sudo service httpd configtest
sudo systemctl restart httpd 

四、OK

相關文章
相關標籤/搜索