这条命令会同时生成一个key文件和一个证书文件,这期间会提示很多问题让你填写,大部分都可以忽略,不过最重要的Common Name
不能忽略,
你需要填写你的域名。类似下面这样:
1 2 3 4 5 6 7
Country Name (2 letter code) [AU]:US State or Province Name (full name) [Some-State]:New York Locality Name (eg, city) []:New York City Organization Name (eg, company) [Internet Widgits Pty Ltd]:Bouncy Castles, Inc. Organizational Unit Name (eg, section) []:Ministry of Water Slides Common Name (e.g. server FQDN or YOUR name) []:api.enzhico.net Email Address []:admin@your_domain.com
server { listen 443 http2 ssl; listen [::]:443 http2 ssl;
server_name api.enzhico.net;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt; ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key; ssl_dhparam /etc/ssl/certs/dhparam.pem; ######################################################################## # from https://cipherli.st/ # # and https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html # ########################################################################
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; ssl_ecdh_curve secp384r1; ssl_session_cache shared:SSL:10m; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; resolver 8.8.8.8 8.8.4.4 valid=300s; resolver_timeout 5s; # Disable preloading HSTS for now. You can use the commented out header line that includes # the "preload" directive if you understand the implications. #add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; add_header Strict-Transport-Security "max-age=63072000; includeSubdomains"; add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff;
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/admtest.enzhico.cn/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/admtest.enzhico.cn/privkey.pem Your cert will expire on 2018-03-28. To obtain a new or tweaked version of this certificate in the future, simply run certbot again. To non-interactively renew *all* of your certificates, run "certbot renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/xncoding.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/xncoding.com/privkey.pem Your cert will expire on 2018-06-24. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again. To non-interactively renew *all* of your certificates, run "certbot-auto renew" - If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
[error] 24267#0: *34 no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking, [error] 24267#0: *35 no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking, [error] 24267#0: *36 no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking, [error] 24267#0: *37 no "ssl_certificate" is defined in server listening on SSL port while SSL handshaking,