====== 汇入 Gandi SSL 凭证到您的 Apache ====== 如果您是从 Gandi AI 上转换到虚拟站台(virtualhost),在您进行本教学之前请参考 [[http://wiki.gandi.net/en/hosting/using-linux/tutorials/gandiai#quit-gandi-ai-to-install-a-ssl-virtualhost-on-apache2|这个文件]] 来调整设定与安装套件。 ===== 安装 Apache 2 ===== 首先,您需要在伺服器上安装 Apache 应用程式。 aptitude install apache2 然后您需要启动 SSL 模组(稍后我们会重开 Apache): a2enmod ssl 接下来,请确认 Apache 有启动 HTTPS 埠。 如果没有,请在 /etc/apache2/ports.conf 这个档案内增加: Listen 443 NameVirtualHost YOUR_IP_ADDRESS:443 ===== 取得中继凭证 ===== 安装中继凭证号,这样您的凭证签发单位就可以被信任,Gandi 的中继凭证在这里: [[en:ssl:intermediate| Gandi 的中继凭证]]。 ===== 启动网域名称的 Apache 加密连线(SSL) ===== 安装您的金钥/凭证与任何必要的中继凭证到伺服器,安装到 /etc/ssl 内: cp cert-domain.tld.crt /etc/ssl/certs/domain.tld.crt cp myserver.key /etc/ssl/private/domain.tld.key cp GandiXXXSSLCA.pem /etc/ssl/certs/GandiXXXSSLCA.pem 请别忘记将 **domain.tld** 替换成您的网域名称。另外 **GandiXXXSSLCA.pem** 这个名称应该是替换成您在 Gandi 取得的中继凭证档 设定 Apache 使用这个网域名称的加密连线,请建立一个独立档案: vi /etc/apache2/sites-available/000-domain.tld-ssl ...设定虚拟站台使用 SSL 连线: ServerName www.domain.tld ServerAlias domain.tld DocumentRoot /var/www/www.domain.tld/ CustomLog /var/log/apache2/secure_access.log combined SSLEngine on SSLCertificateFile /etc/ssl/certs/domain.tld.crt SSLCertificateKeyFile /etc/ssl/private/domain.tld.key SSLCertificateChainFile /etc/ssl/certs/GandiXXXSSLCA.pem SSLVerifyClient None 重新启动 Apache 之后 SSL 连线就会启用: a2ensite 000-domain.tld-ssl /etc/init.d/apache2 reload 如果您的伺服器有开启防火墙,请记得开启 443 埠的连线。 ===== 检查你的 SSL 链(Chain)是否完整正确 ===== 使用 openssl 指令来测试您的连线,请将 IP 位置(或是网域名称)替换成实际的值,并连接服务的埠(Apache2/SSL 埠是 443): openssl s_client -connect ip.ip.ip.ip:port 或是使用 http://www.digicert.com/help/ 的视觉化界面来帮助您除错。