ssl證書獲取
1.可以去各種云申請(qǐng)免費(fèi)證書
2.如果已有其他格式證書需要轉(zhuǎn)換
- 比如我已有pfx證書,執(zhí)行以下命令轉(zhuǎn)化,得到pem、key
openssl pkcs12 -in xxx.pfx -nodes -out xxx.pem
openssl rsa -in xxx.pem -out xxx.key
openssl x509 -in xxx.pem -out xxx.crt
- 前提是windows環(huán)境需要安裝openssl,下載地址:https://slproweb.com/products/Win32OpenSSL.html
- 執(zhí)行上面三個(gè)命令大概率會(huì)報(bào)錯(cuò),不支持算法之類的
- 重:一定要下載老版本的openssl, 比如1.x.x版本
nginx基本配置
server {
listen 80;
location / {
proxy_pass http://localhost:8085;
client_max_body_size 64m;
}
}
server {
listen 443 ssl;
server_name domain;
ssl_certificate C:/xxx/xxxx.pem;
ssl_certificate_key C:/xxx/xxxx.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:8085;
client_max_body_size 64m;
}
}