1、viconf/httpd.conf
查找 #Include conf/extra/httpd-ssl.conf (刪除行首的配置語句注釋符號“#”保存退出)
2、viconf/extra/httpd-ssl.conf
注釋所有的 VirtualHost 里面的代碼
- <VirtualHost *:443>
- DocumentRoot "/www/web/smallshop/public_html"
- ServerName demo.smallshop.me:443
- ServerAdmin [email protected]
- ErrorLog "/www/wdlinux/httpd-2.4.18/logs/error_log"
- TransferLog "/www/wdlinux/httpd-2.4.18/logs/access_log"
- SSLEngine on
- SSLCertificateFile /www/ssl/smallshop/public.pem
- SSLCertificateKeyFile /www/ssl/smallshop/213979745040220.key
- SSLCACertificateFile /www/ssl/smallshop/chain.pem
- <FilesMatch "/.(cgi|shtml|phtml|php)$">
- SSLOptions +StdEnvVars
- </FilesMatch>
- <Directory "/www/wdlinux/httpd-2.4.18/cgi-bin">
- SSLOptions +StdEnvVars
- </Directory>
- BrowserMatch "MSIE [2-5]" /
- nokeepalive ssl-unclean-shutdown /
- downgrade-1.0 force-response-1.0
- CustomLog "/www/wdlinux/httpd-2.4.18/logs/ssl_request_log" /
- "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x /"%r/" %b"
- </VirtualHost>
然后在末尾加上以上代碼
這樣可以同時開啟多個站點的https訪問。
如果需要開啟http強制跳轉到https可以在.htaccess里面加上下面的代碼
- RewriteBase /
- RewriteCond %{SERVER_PORT} !^443$
- RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
如果提示SSLSessionCache: 'shmcb' session cache not supported (known names: ). Maybe錯誤
在conf/httpd.conf里面找到LoadModule socache_shmcb_module modules/mod_socache_shmcb.so 去掉開頭的#就可以了。
新聞熱點
疑難解答