nginx 配置https 作者: juoliii 时间: 2023-05-07 分类: 开发,运维 1.申请https证书 [https://freessl.cn/](https://www.oschina.net/action/GoToLink?url=https%3A%2F%2Ffreessl.cn%2F) 这个网站上可以申请免费https证书 2.修改nginx配置文件 ``` server { listen 80; listen 443 ssl; server_name a.com; ssl_certificate /www/a.crt; ssl_certificate_key /www/a.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!KRB5:!aECDH:!EDH+3DES; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; error_page 497 https://$host$request_uri; index index.html index.htm index.php; root /www/wwwroot/a.com; if ($server_port !~ 443) { rewrite ^(/.*)$ https://$host$1 permanent; } access_log /www/wwwlogs/admin.log; error_log /www/wwwlogs/admin.error.log; } ``` **此处设置了http强制跳转https** 标签: none
评论已关闭