Nginx配置HTTPS

来源:互联网 发布:阿里云ftp端口号 编辑:程序博客网 时间:2024/06/14 05:18

生成没有密码的文件
要使用https,那么需要四个步骤
第一步生成key
openssl genrsa -des3 -out ilovewqf.xicp.net.key
这个命令不写强度,默认强度就是1024
生成没有密码的key文件,但是还是要输入密码
openssl rsa -in ilovewqf.xicp.net.key -out ilovewqf.xicp.net.nopass.key

第二步 生成CA的crt文件
openssl req -new -x509 -key ilovewqf.xicp.net.key -out ca.crt -days 3650

第三步 生成CSR
req -new -key ilovewqf.xicp.net.key -out server.csr

第四步生成crt
openssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey ilovewqf.xicp.net.key -CAcreateserial -out server.crt
这个命令特别长

第五步 证书合并
cat ilovewqf.xicp.net.key server.crt > server.pem

https://localhost
在配置nginx的时候,可以使用ilovewqf.xicp.net.nopass.key这样启动nginx时不需要手动输入密码。