nginx配置ssl证书,


在你的nginx.conf配置文件中设置

server {
listen 443;
server_name www.baidu.com;//这块一定要填写您的域名
ssl on;
root html;
index index.html index.htm;
ssl_certificate /www/server/nginx/cert/2110947_baidu.com.pem;//配置绝对路径
ssl_certificate_key /www/server/nginx/cert/2110947_baidu.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {

 root html;
 index index.html index.htm;

}
}

//https强制访问
server {

listen 80;
server_name www.baidu.com;//您的域名
rewrite ^(.*)$ https://$host$1;// 把http的域名请求转成https

}

相关内容