【重要】此文参考Vincent.李-Windows下Nginx配置SSL实现Https访问(包含证书生成)
1: 创建私钥;idiotadam自定义,输入密码后,再次重复输入确认密码。记住此密码,后面会用到
openssl genrsa -des3 -out idiotadam.key 1024
2: 创建csr证书,输入的信息中最重要的为 Common Name,这里输入的域名即为我们要使用https访问的域名
openssl req -new -key idiotadam.key -out idiotadam.csr
3: 去除密码;在加载SSL支持的Nginx并使用上述私钥时除去必须的口令,否则会在启动nginx的时候需要输入密码
copy idiotadam.key idiotadam.key.org
openssl rsa -in idiotadam.key.org -out idiotadam.key 此处在执行时需要输入创建私钥市输入的密码
4 生成crt证书
openssl x509 -req -days 365 -in idiotadam.csr -signkey idiotadam.key -out idiotadam.crt
5 修改nginx的配置文件nginx.config
6 重启nginx
nginx -s reload