Nginx 配置 SSL

1.对应的云服务器中申请免费证书

2.配置Nginx

 

server {
listen 443 ssl;
server_name baidu.com;
ssl on;

index index.html index.htm;
ssl_certificate /etc/nginx/cert/*******_bundle.crt;
ssl_certificate_key /etc/nginx/cert/*******.key;
ssl_session_timeout 10m;
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;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
root /usr/share/nginx/youwei;
location / {
index index.html index.htm;
}
}

server {
listen 80;
server_name chinafirst.club;
rewrite ^(.*)$ https://baidu.com;
}

3.重启Nginx(建议使用 stop 然后再 start)

4.不管用重启服务器

 

posted @ 2022-05-30 17:47  贾斯丁哔哔  阅读(103)  评论(0)    收藏  举报