Skip to content

Instantly share code, notes, and snippets.

@aizigao
Last active January 9, 2018 05:37
Show Gist options
  • Save aizigao/98daabc43c93db7414a7c4af30a1a36c to your computer and use it in GitHub Desktop.
Save aizigao/98daabc43c93db7414a7c4af30a1a36c to your computer and use it in GitHub Desktop.
生成测试用https 的ssl,chrome 57版本之后版本

生成https 的ssl

  • shell
openssl req \
    -newkey rsa:2048 \
    -x509 \
    -nodes \
    -keyout server.key \
    -new \
    -out server.crt \
    -subj /CN=m.dev.shop.hisense.com \
    -reqexts SAN \
    -extensions SAN \
    -config <(cat /System/Library/OpenSSL/openssl.cnf \
        <(printf '[SAN]\nsubjectAltName=DNS:m.dev.shop.test.com')) \
    -sha256 \
    -days 3650
  • chrome
chrome://net-internals/#hsts
  • nginx

server {
  listen 80;
  listen [::]:80;
  listen 443 ssl;
  server_name m.dev.shop.test.com;
  ...
  ssl_certificate /Users/martin/MyWorkPlace/test2/dev/server.crt;
  ssl_certificate_key /Users/martin/MyWorkPlace/test2/dev/server.key;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment