Linux安装免费SSL证书

  |   Nginx SSL HTTPS

Let's Encrypt是国外一个公共的免费SSL项目,由 Linux 基金会托管。这就是我找到了免费SSL证书。然后我一步一步地安装SSL证书,再启动nginx服务,就打开没问题了。

下载letsencrypt文件

# git clone https://github.com/letsencrypt/letsencrypt

打开letsencrypt文件

# cd letsencrypt

运行letsencrypt-auto

# ./letsencrypt-auto
Saving debug log to /var/log/letsencrypt/letsencrypt.log

How would you like to authenticate and install certificates?
-------------------------------------------------------------------------------
1: Apache Web Server plugin - Beta (apache)
2: Nginx Web Server plugin - Alpha (nginx)
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2  输入为“2”
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): jinzita001@gmail.com  输入为“您的电子邮箱”

-------------------------------------------------------------------------------
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v01.api.letsencrypt.org/directory
-------------------------------------------------------------------------------
(A)gree/(C)ancel: a  输入为“a” 表示同意

-------------------------------------------------------------------------------
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about EFF and
our work to encrypt the web, protect its users and defend digital rights.
-------------------------------------------------------------------------------
(Y)es/(N)o: y  输入为“y”表示是

Which names would you like to activate HTTPS for?
-------------------------------------------------------------------------------
1: iiiciii.com
2: bbs.yulong360.com
3: note.yulong360.com
4: www.yulong360.com
-------------------------------------------------------------------------------
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 2,3,4  输入为“选择哪个域名”
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for bbs.yulong360.com
http-01 challenge for note.yulong360.com
http-01 challenge for www.yulong360.com
Using default addresses 80 and [::]:80 ipv6only=on for authentication.
Waiting for verification...
Cleaning up challenges
Deployed Certificate to VirtualHost /etc/nginx/conf.d/bbs.conf for bbs.yulong360.com
Deployed Certificate to VirtualHost /etc/nginx/conf.d/ghost.conf for note.yulong360.com
Deployed Certificate to VirtualHost /etc/nginx/conf.d/ssl.conf for www.yulong360.com

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
-------------------------------------------------------------------------------
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
-------------------------------------------------------------------------------
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2  输入为"2"表示重定向-使所有请求重定向到安全的HTTPS访问

-------------------------------------------------------------------------------
Congratulations! You have successfully enabled https://bbs.yulong360.com,
https://note.yulong360.com, and https://www.yulong360.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=bbs.yulong360.com
https://www.ssllabs.com/ssltest/analyze.html?d=note.yulong360.com
https://www.ssllabs.com/ssltest/analyze.html?d=www.yulong360.com
-------------------------------------------------------------------------------

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/bbs.yulong360.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/bbs.yulong360.com/privkey.pem
   Your cert will expire on 2018-04-28. To obtain a new or tweaked
   version of this certificate in the future, simply run
   letsencrypt-auto again with the "certonly" option. To
   non-interactively renew *all* of your certificates, run
   "letsencrypt-auto 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