启用Apache ssl模块:
a2enmod ssl
启用433端口:
vim /etc/apache2/ports.conf
添加:Listen 433
将申请证书时获得的四个文件上传到服务器:
ca.pem ssl.crt ssl.key sub.class1.server.ca.pem
增加虚拟主机SSL,确保包含以下内容:
http://www.startssl.com/?app=21
重定向设置:
启用rewrite模块
a2enmod rewrite
在配置文件中加入以下内容
RewriteEngine on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{REQUEST_URI} !^/help/(.*)$
RewriteRule ^/?(.*)$ https://%{SERVER_NAME}/$1 [L,R]