在 nginx 中使用 certbot 的问题

G.D*_*G.D 26 https nginx reactjs lets-encrypt certbot

我实际上正在开发一个 web 应用程序,我Reactjs用于前端和Golang后端。这两个程序分别托管在Google-Compute-Engine. 我想为我的应用程序提供服务,https所以我选择Nginx用于在生产中为前端提供服务。首先,我为以下内容制作了配置文件Nginx

#version: nginx/1.14.0 (ubuntu)
server {
     listen 80 default_server;
     listen [::]:80 default_server;

     root /var/www/banshee;
     server_name XX.XXX.XX.XXX; #public IP of my frontend VM

     index index.html;

     location / {
       try_files $uri /index.html =404;
     }
   }
Run Code Online (Sandbox Code Playgroud)

对于这部分,一切都按预期工作,但在那之后,我想https按照本教程为我的应用程序提供服务。我安装的软件包software-properties-commonpython-certbot-apache 以及certbot但是当我试图

sudo cerbot --nginx certonly

我收到以下消息:

gdes@frontend:/etc/nginx$ sudo certbot --nginx certonly
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Could not choose appropriate plugin: The requested nginx plugin does not appear to be installed
The requested nginx plugin does not appear to be installed
Run Code Online (Sandbox Code Playgroud)

我在谷歌和这里进行了一些搜索,但我仍然无法弄清楚缺少哪个插件或其他解决方法。

有人有想法可以帮助我吗?

非常感谢 :)

Vir*_*oop 74

我试图为我的子域使用 certbot 创建 let'sencrypt 证书并遇到以下问题。 命令 :

ubuntu@localhost:~$ certbot --nginx -d my_subdomain.website.com

问题 :

请求的 nginx 插件似乎没有安装

解决方案:

Ubuntu 20+

ubuntu@localhost:~$ sudo apt-get install python3-certbot-nginx

早期版本

ubuntu@localhost:~$ sudo apt-get install python-certbot-nginx

  • 在 Ubuntu 20.04 中,包名称为“python3-certbot-nginx” (19认同)

Ros*_*ing 5

您可以使用以下命令安装 Certbot nginx 插件:

add-apt-repository ppa:certbot/certbot
apt update
apt install python-certbot-nginx
Run Code Online (Sandbox Code Playgroud)

  • 是的,域名需要解析到运行 certbot 的服务器才能验证您是否拥有该域。 (2认同)

Joz*_*ott 5

你需要更换

apt install python-certbot-nginx
Run Code Online (Sandbox Code Playgroud)

经过

apt install python3-certbot-nginx
Run Code Online (Sandbox Code Playgroud)