安裝相應模塊: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