1.生成ssl证书
这边有生成好的ssl证书,也可以用openssl自己生成
https://download.youkuaiyun.com/download/whiteforever/10607879
证书放在nginx的conf目录下

2.配置nginx
这边nginx的版本是1.12.2
环境:window7
配置conf下的 nginx.conf
server {
listen 443;
server_name www.xmtyw.cn; #填写绑定证书的域名
ssl on;
ssl_certificate server.crt;
ssl_certificate_key server.key;
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;
location / {
root web; #站点目录
index index.html index.htm;
}
在 {nginx_home}/ 新增web目录

随便在web目录下放置一个静态的hello.html

hello.html内容如下
hello world!!
3.启动nginx.
在{nginx_home} 点击 nginx.exe 然后打开火狐 访问 路径 https://localhost/hello.html
因为证书是自己创建的 所以火狐会报不信任,添加例外即可 ,添加成功后 显示如下

已经配置好的nginx路径:
https://download.youkuaiyun.com/download/whiteforever/10607919
本文详细介绍了如何生成SSL证书,并使用Nginx配置HTTPS服务。从下载或自动生成证书,到Nginx配置文件的修改,以及如何验证配置是否正确,最后解决浏览器对自签名证书的信任问题。
7993

被折叠的 条评论
为什么被折叠?



