发布:2022/5/22 22:45:25作者:管理员 来源:本站 浏览次数:1143
Windows下Nginx配置SSL实现Https访问(包含证书生成)
在执行openssl req -new -key lee.key -out lee.csr 命令的时候,需要指定openssl.conf文件位置;
openssl req -new -key lee.key -config "D:\AMD64-Win64OpenSSL-0_9_8g\openssl.conf" -out lee.csr
在启动nginx的时候,需要把lee.key和lee.crt拷贝到conf目录下面,nginx.conf文件修改为:
server {
listen 443 ssl;
server_name www.stono.com;
ssl_certificate lee.crt;
ssl_certificate_key lee.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;
}
}
或者修改文件的目录为反斜线也是可以的;
server {
listen 443 ssl;
server_name www.stono.com;
ssl_certificate D:/nginx-1.12.2/ssl/lee.crt;
ssl_certificate_key D:/nginx-1.12.2/ssl/lee.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;
}
}