将 certbot 与 nginx 一起使用的问题

新手上路,请多包涵

我实际上正在开发一个 web 应用程序,我使用 Reactjs 作为前端,使用 --- Golang 作为后端。这两个程序分别托管在 Google-Compute-Engine 上的 2 个虚拟机上。我想通过 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;
     }
   }

对于这部分,一切都按预期工作,但之后我想按照 本教程 通过 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

我在 Google 和此处进行了一些搜索,但我仍然无法确定缺少哪个插件或其他解决此问题的方法。

有人有帮助我的想法吗?

非常感谢 :)

原文由 G.D 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.1k
2 个回答

我试图使用 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

原文由 Viraj Wadate 发布,翻译遵循 CC BY-SA 4.0 许可协议

您将需要更换

apt install python-certbot-nginx

经过

apt install python3-certbot-nginx

原文由 Jozott 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Stack Overflow 翻译
子站问答
访问
宣传栏