Nginx支持HTTPShtml
Nginx-HTTPSlinux |
SSL证书安装nginx |
S1.安装OpenSSLweb http://slproweb.com/products/Win32OpenSSL.htmlwindows S2.设置环境变量session 变量名:OPENSSL_HOMEui 变量值:D:\OpenSSL-Win64\bin;spa Path后添加: %OPENSSL_HOME%server S3.生成证书htm // 建立私钥 openssl genrsa -des3 -out private.key 1024 // 建立csr证书 openssl req -new -key private.key -out private.csr // 复制private.key并重命名为private.key.org // 去除密码 openssl rsa -in private.key.org -out private.key // 生成crt证书 openssl x509 -req -days 365 -in private.csr -signkey private.key -out private.crt |
Nginx-windows配置 |
server { listen 443 ssl; # 端口 server_name localhost;
ssl_certificate C://nginx//ssl//buduhuisi.crt; # 这个是证书的crt文件所在目录 ssl_certificate_key C://nginx//ssl//buduhuisi.key; # 这个是证书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; # 这个是指定首页的文件名 } } |
|
|
Ref:
http://www.javashuo.com/article/p-oannvjet-x.html // windows
http://www.javashuo.com/article/p-oannvjet-x.html // linux
http://nginx.org/en/docs/http/configuring_https_servers.html // nginx