为Nginx添加Comodo SSL证书
首先安装Nginx,根据自己的Linux发行版安装好Nginx或者也可以参照Nginx官方的安装教程。
1. 根据获得的SSL证书内容,将获得的证书进行合并操作
如果你得到的是以下四个证书,请用如下命令(将www_yourdomain_com换成自己的)
cat www_yourdomain_com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > ssl-bundle.crt
如果你得到的是以下两个证书,请用如下命令(将www_yourdomain_com换成自己的)
cat www_yourdomain_com.crt www_yourdomain_com.ca-bundle > ssl-bundle.crt
2. 修改Nginx的虚拟主机配置(位置可能位于/etc/nginx/sites-available/或/usr/local/nginx/sites-available/),参考下面的证书配置进行添加修改
server {
listen 443;
server_name 111cn.net;
ssl on;
ssl_certificate /etc/ssl/certs/ssl-bundle.crt;
ssl_certificate_key /etc/ssl/private/mysite.key;
#enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#Disables all weak ciphers
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
}