我实际上正在开发一个网络应用程序,我使用
Reactjs
作为前端,Golang
作为后端。这 2 个程序分别托管在 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-common
、python-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
我在谷歌和这里进行了一些搜索,但我仍然无法弄清楚缺少哪个插件或解决此问题的其他方法。
有人有主意可以帮助我吗?
非常感谢:)
我尝试使用 certbot 为我的子域创建 Let's Encrypt 证书,但遇到了以下问题。 命令:
ubuntu@localhost:~$ certbot --nginx -d my_subdomain.website.com -d my_subdomain2.website.com
问题:
请求的 Nginx 插件似乎未安装
解决方案:
Ubuntu 20+
ubuntu@localhost:~$ sudo apt-get install python3-certbot-nginx
早期版本
ubuntu@localhost:~$ sudo apt-get install python-certbot-nginx
您需要更换
apt install python-certbot-nginx
由
apt install python3-certbot-nginx
您可以使用以下命令安装 Certbot nginx 插件:
add-apt-repository ppa:certbot/certbot
apt update
apt install python-certbot-nginx
您必须重新安装 python3 版本的 Lets Encrypt 的 certbot。
奔跑
sudo apt-get install python3-certbot-nginx
在 Debian 10 上,
certbot
返回“无法找到可用的 nginx 二进制文件”问题,因为 PATH 中缺少“/usr/sbin”。将 /usr/sbin 添加到 PATH
export PATH=/usr/sbin:$PATH
然后
certbot
就可以给nginx制作证书了
certbot --nginx -d <server name> --post-hook "/usr/sbin/service nginx restart"
certbot
,请执行以下操作:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot
sudo apt-get install python3-certbot-nginx
sudo certbot --nginx
sudo apt-get install python3-certbot-nginx
sudo certbot --nginx