获取服务器证书文件,找到Nginx文件夹中的证书。
安装服务器证书,复制 server.key、server.crt 文件到 Nginx 安装目录下的 conf 目录。
打开 Nginx 安装目录下 conf 目录中的 nginx.conf 文件,找到
# HTTPS server##server {# listen 443;# server_name localhost;# ssl on;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_timeout 5m;# ssl_protocols SSLv2 SSLv3 TLSv1;# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}
将其修改为
server {listen 443;server_name localhost;ssl on;ssl_certificate server.crt;ssl_certificate_key server.key;ssl_session_timeout 5m;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ECDHHIGH:!RC4:!DH:!MD5:!aNULL:!eNULL;
ssl_prefer_server_ciphers on;location / {root html;index index.html index.htm;}}
保存退出,并重启 Nginx。
通过 https 方式访问您的站点,测试站点证书的安装配置。
注意:server.crt 是服务器证书 中级证书的整合,即如下:
——-BEGIN CERTIFICATE——-
邮件里的服务器证书代码
——-END CERTIFICATE——-
——-BEGIN CERTIFICATE——-
中间证书代码
——-END CERTIFICATE——-