天天看点

Nginx搭建https

参考:

https://juejin.im/post/590ec765a22b9d0058fcfaa5

https://www.cnblogs.com/yjmyzz/p/openssl-tutorial.html

键入命令:

cd /usr/local/nginx/conf
//下面要填密码和一堆信息
openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl req -new -x509 -key server.key -out ca.crt -days 3650           

复制

在nginx配置文件里配置:

server {
            listen  80;
            listen  443 ssl;

            ssl_certificate  /usr/local/nginx/conf/ca.crt;
            ssl_certificate_key  /usr/local/nginx/conf/server.key;

    }           

复制

重启nginx生效