hincky的主页 hincky的主页
  • 学习笔记

    • Vue笔记
    • Vuepress
    • nginx
  • 语言类

    • java
    • go
    • python
    • 设计模式
  • 框架类

    • Spring
    • Spring Security
    • Mybatis
  • 容器技术

    • docker
    • k8s
    • helm
    • prometheus
    • grafana
    • jenkins
  • 命令集合

    • linux命令
    • docker命令
    • git命令
    • vim命令
    • k8s命令
  • 数据库

    • sql
    • mysql
  • 协议

    • 网络模型
    • http/1.1
    • WebSocket
    • http/2
    • TLS/SSL
    • tcp
    • IP
    • tcpdump抓包命令
    • wireshark抓包工具
  • 通用

    • Git
  • 技术分享

    • git push/pull总是超时怎么办
    • idea debug技巧
    • postman使用
    • 问题总结
    • idea使用技巧
  • Oauth2

    • Oauth2原理
  • 项目列表

    • redis项目
    • 微服务项目
  • 分类
  • 标签
  • 归档
  • 随笔
GitHub (opens new window)

Hincky

当有趣的人,做想做的事
  • 学习笔记

    • Vue笔记
    • Vuepress
    • nginx
  • 语言类

    • java
    • go
    • python
    • 设计模式
  • 框架类

    • Spring
    • Spring Security
    • Mybatis
  • 容器技术

    • docker
    • k8s
    • helm
    • prometheus
    • grafana
    • jenkins
  • 命令集合

    • linux命令
    • docker命令
    • git命令
    • vim命令
    • k8s命令
  • 数据库

    • sql
    • mysql
  • 协议

    • 网络模型
    • http/1.1
    • WebSocket
    • http/2
    • TLS/SSL
    • tcp
    • IP
    • tcpdump抓包命令
    • wireshark抓包工具
  • 通用

    • Git
  • 技术分享

    • git push/pull总是超时怎么办
    • idea debug技巧
    • postman使用
    • 问题总结
    • idea使用技巧
  • Oauth2

    • Oauth2原理
  • 项目列表

    • redis项目
    • 微服务项目
  • 分类
  • 标签
  • 归档
  • 随笔
GitHub (opens new window)
  • 数据库

  • 网络协议以及抓包工具

    • http1.1

    • WebSocket

    • http2

    • TLS&SSL

      • TLS
      • SSL
        • 注册/生成ssl证书
        • 设置过期自动更新ssl证书
    • tcp

    • ip

    • 网络排查

    • tcpdump抓包命令
      • BPF
        • libpcap
        • tcpdump调用关系
      • 抓包文件格式
      • tcpdump命令基本用法
      • 抓取http内容
      • 如何过滤报文
    • chrome开发者工具
      • 快捷打开开发者工具
      • 具体问题查找路径
    • WireShark抓包工具
  • Git笔记

  • 技术分享

  • Oauth2

  • 计算机相关技术
  • 网络协议以及抓包工具
  • TLS&SSL
hincky
2023-02-03
目录

SSL

  • 注册/生成ssl证书
  • 设置过期自动更新ssl证书

# 注册/生成ssl证书

参考官方文档 (opens new window)

  1. Download the Let’s Encrypt Client
apt-get update
sudo apt-get install certbot
apt-get install python3-certbot-nginx
#apt-get install python-certbot-nginx
1
2
3
4
  1. Set Up NGINX

certbot can automatically configure NGINX for SSL/TLS. It looks for and modifies the server block in your NGINX configuration that contains a server_name directive with the domain name you’re requesting a certificate for. In our example, the domain is www.example.com.

  • Assuming you’re starting with a fresh NGINX install, use a text editor to create a file in the /etc/nginx/conf.d directory named domain‑name.conf (so in our example, www.example.com.conf).

  • Specify your domain name (and variants, if any) with the server_name directive:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html;
    server_name example.com www.example.com;
}
1
2
3
4
5
6
  • Save the file, then run this command to verify the syntax of your configuration and restart NGINX:
nginx -t && nginx -s reload
1
  1. Obtain the SSL/TLS Certificate
  • Run the following command to generate certificates with the NGINX plug‑in:
sudo certbot --nginx -d example.com -d www.example.com
1

# 设置过期自动更新ssl证书

使用crontab设定定时更新查询任务

docker容器内安装crontab

apt-get -y install -qq --force-yes cron
# yum install -y -qq --force-yes cron
1
2

crontab使用概览 (opens new window)

设置定时任务

crontab -e 
0 12 * * * /usr/bin/certbot renew --quiet
1
2
编辑 (opens new window)
TLS
tcp

← TLS tcp→

最近更新
01
人生前期重要的能力
05-17
02
防火墙命令
04-11
03
docker-compose部署mysql主从集群
03-22
更多文章>
Theme by Vdoing | Copyright © 2022-2023 Hincky | MIT License | 粤ICP备2022120427号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式