一、准备条件
1、安装Nginx,参考:Linux 离线安装Nginx
2、生成ssl证书,参考:自签名SSL证书生成
二、配置https
cd /usr/local/nginx/conf
vi nginx.conf
## 添加如下内容:
server {
listen 443 ssl;
server_name localhost;
ssl_certificate cert.crt; ## 公钥证书
ssl_certificate_key cert.key; ## 私钥文件
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
三、重启nginx
systemctl nginx restart
四、验证
## 浏览器访问 https://127.0.0.1
标签:index,https,ssl,##,访问,Nginx,nginx
From: https://www.cnblogs.com/yhzou/p/18623593