https证书

Posted 从零开始的linux

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了https证书相关的知识,希望对你有一定的参考价值。

获取certbot

 
   
   
 
  1. wget https://dl.eff.org/certbot-auto

  2. chmod a+x certbot-auto

安装nginx

 
   
   
 
  1. yum -y install nginx

生成证书

 
   
   
 
  1. ./certbot-auto certonly --standalone --email syf@alexorz.com --agree-tos -d alexorz.com

查看生成的证书

 
   
   
 
  1. ll /etc/letsencrypt/live/alexorz.com/privkey.pem

  2. lrwxrwxrwx 1 root root 38 Nov 10 01:59 /etc/letsencrypt/live/alexorz.com/privkey.pem

  3. ll /etc/letsencrypt/live/alexorz.com/fullchain.pem

  4. lrwxrwxrwx 1 root root 40 Nov 10 01:59 /etc/letsencrypt/live/alexorz.com/fullchain.pem -> ../../archive/alexorz.com/fullchain1.pem

在nginx配置证书

 
   
   
 
  1. server {

  2.        listen       443 ssl http2 default_server;

  3.        listen       [::]:443 ssl http2 default_server;

  4.        server_name  _;

  5.        root         /usr/share/nginx/html;

  6.        ssl_certificate "/etc/letsencrypt/live/alexorz.com/fullchain.pem";

  7.        ssl_certificate_key "/etc/letsencrypt/live/alexorz.com/privkey.pem";

  8.        ssl_session_cache shared:SSL:1m;

  9.        ssl_session_timeout  10m;

  10.        ssl_ciphers HIGH:!aNULL:!MD5;

  11.        ssl_prefer_server_ciphers on;

  12.        # Load configuration files for the default server block.

  13.        include /etc/nginx/default.d/*.conf;

启动nginx

 
   
   
 
  1. nginx





以上是关于https证书的主要内容,如果未能解决你的问题,请参考以下文章

Https 忽略证书使用自定义证书的java代码实现

Go代码打通HTTPs

这两个代码片段有啥区别?

WAMP——配置HTTPS证书

WAMP——配置HTTPS证书

PHP代码-psysh调试代码片段工具