获取证书
我服务器是腾讯云的,在腾讯云的搜索界面搜索下SSL
点击申请免费证书
填写你的信息就好了--等待审核 一般一小时内就会完成验证
注意:通用名称输入的是绑定的域名哦~
验证完成之后下载证书即可
开始配置
把下载完成的证书放在服务器下(最好放在NGINX目录下 这样好找)
server {
listen 443 ssl;
server_name 你的域名;
root /usr/share/nginx/www/blog;
#SSL的主要配置--开始
ssl on;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
ssl_certificate cert/1_证书.cn_bundle.crt;
ssl_certificate_key cert/2_证书.cn.key;
#SSL的主要配置--结束
# Load configuration files for the default server block.
location / {
root root;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/www/blog;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
error_page 404 /404.html;
location = /40x.html {
}
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
}