OpenSSL

製作證書,停掉docker所佔用的80端口,啟動Ubuntu本身的Nginx。

Nginx通常在etc/nginx 目錄下,配置nginx.conf 或者 /etc/nginx/sites-available/default.

讓certbot 可以訪問到80服務。Nginx配置.well-known/acme-challenge 訪問路徑,並設置allow all權限,certbot可以寫入。

1. Create fullchain.pem and privkey.pem

复制代码
openssl req -new -nodes \
  -newkey rsa:2048 \
  -keyout privkey.pem \
  -out cert.csr \
  -config openssl.cnf

2.. Cerbot apply Let's Encrypt

复制代码
certbot certonly --manual --csr request.csr
或者

certbot certonly --webroot -w /var/www/html -d yourdomain.com
  1. /etc/nginx/sites-available 修改Nginx配置文件

    复制代码
     listen 80;
     listen [::]:80;
    
     server_name erp.vital-base.com;
    
     location /.well-known/acme-challenge/ {
         root /var/www/html;
         allow all;
     }
  2. 創建測試文件

    sudo mkdir -p /var/www/html/.well-known/acme-challenge
    echo hello | sudo tee /var/www/html/.well-known/acme-challenge/test.txt

复制代码
http://erp.vital-base.com/.well-known/acme-challenge/test.txt
  1. 結果

/var/www/html 與Nginx 保持一致

复制代码
certbot certonly --webroot -w /var/www/html -d domain.com
  1. 如果用Docker,需要掛載

    cannot load certificate "/etc/ssl/myerp/fullchain.pem"
    : BIO_new_file() failed (SSL: error:80000002:system
    library::No such file or directory:calling
    fopen(/etc/ssl/myerp/fullchain.pem, r)
    error:10000080:BIO routines::no such file)

    查看目錄下有沒有文件

    ls -l /opt/myspace/wrp/ssl2

    chmod 644 /opt/workspace/worker_myerp/ssl2/*.pem

    或者

    chmod -R 755 /opt/workspace/worker_myerp/ssl2

相关推荐
瀚高PG实验室1 小时前
hghac8008漏洞扫描处理
linux·网络·windows·瀚高数据库
MarkHD2 小时前
自动化桌面整理脚本——用GUI自动化终结混乱(Day 19-20)
运维·自动化
funnycoffee1232 小时前
华为,华三交换机开启snmp的命令
服务器·华为·华为snmp·华三snmp
AD钙奶-lalala2 小时前
Error starting ApplicationContext. To display the condition evaluation···
linux·运维·服务器
市安2 小时前
基于Debain构建Ngxin镜像
运维·nginx·docker·云原生·容器·debian·镜像
未来之窗软件服务2 小时前
平台对接(2)美团/抖音/饿了么/有赞/微信/京东券核销服务商模式—东方仙盟
大数据·运维·微信·平台对接·仙盟创梦ide·东方仙盟·东方仙盟sdk
阿正的梦工坊2 小时前
Nginx(发音:engine x)是什么?
运维·nginx
71ber2 小时前
RHCSE 实战笔记: LVS 负载均衡集群深度解析
linux·服务器·lvs
未来之窗软件服务2 小时前
平台对接(1)美团/抖音/饿了么/有赞/微信/京东券核销—东方仙盟
服务器·微信·平台对接·仙盟创梦ide·东方仙盟·东方仙盟sdk