我一直在网上学习一些教程,并已启动并运行了我的 flask 应用程序。我已添加域名,它们运行正常。但是,现在我尝试使用 Certbot 获取 nginx 的 SSL 证书。
由于我已经创建了证书,所以这是命令。
certbot install --cert-name domainname.com
我不断收到错误:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Deploying certificate
Could not install certificate
Could not automatically find a matching server block for wehavetheleads.org. Set the `server_name` directive to use the Nginx installer.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
这是我的 etc/nginx/sites_enabled 配置文件:
server {
listen 80;
server_name <public-server-ip>;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
答案1
您server_name
需要包含您的服务的域名,而不是 IP 地址。