nginx配置本地https

2021/11/3 7:12:53

本文主要是介绍nginx配置本地https,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

OpenSSL创建自签名证书

openssl req -sha256 -newkey rsa:2048 -nodes -keyout agsenterprise.key -x509 -days 3650 -out agsenterprise.crt -config /usr/local/etc/openssl@1.1/openssl.cnf -extensions v3_req

Common Name填写你要访问的域名地址

修改openssl.cnf文件

  [ req ]
  req_extensions = v3_req # The extensions to add to a certificate request

  [ v3_req ]
  subjectAltName = @alt_names

  [ alt_names ]
  DNS.1 = chenfengami.com

nginx配置

  server {
    listen 80;
    listen 443 ssl;
    ssl_certificate test/agsenterprise.crt;
    ssl_certificate_key test/agsenterprise.key;
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout 5m;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;
    server_name chenfengami.com;

    location / {
      proxy_pass http://127.0.0.1:3000/;
    }
  }   

将生成crt文件拖入并且添加信任

访问即可

参考: https://blog.csdn.net/zssai2015/article/details/85049905



这篇关于nginx配置本地https的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程