错误:找不到与“Nginx Full”匹配的配置文件

Sur*_*nde 12 nginx

我已经安装了最新版本的 nginx,安装成功。

但是在输入以下命令时出错。

sudo ufw 允许'Nginx Full'

错误:错误:找不到与“Nginx Full”匹配的配置文件

sudo ufw 应用程序列表

只显示

可用的应用程序:

开放式SSH

如何添加应用程序。Nginx 完整 Nginx HTTP Nginx HTTPS OpenSSH

我已经安装了两次 nginx 服务器

错误:错误:找不到与“Nginx Full”匹配的配置文件

小智 28

Ubuntu (18.04)

您可以通过运行以下命令查看哪些应用程序可用:

ufw app list
Run Code Online (Sandbox Code Playgroud)

端口:HTTP - 80 HTTPS - 443

将它们添加到 UFW 的简单方法:

ufw allow 80,443/tcp
Run Code Online (Sandbox Code Playgroud)

如果您想通过应用程序完成此操作,您需要在 /etc/ufw/applications.d 中创建应用程序 ini 文件

例子:

vi /etc/ufw/applications.d/nginx.ini
Run Code Online (Sandbox Code Playgroud)

把这个放在文件里

[Nginx HTTP]
title=Web Server 
description=Enable NGINX HTTP traffic
ports=80/tcp

[Nginx HTTPS] \
title=Web Server (HTTPS) \
description=Enable NGINX HTTPS traffic
ports=443/tcp

[Nginx Full]
title=Web Server (HTTP,HTTPS)
description=Enable NGINX HTTP and HTTPS traffic
ports=80,443/tcp
Run Code Online (Sandbox Code Playgroud)

然后输入这个命令

ufw app update nginx

ufw app info 'Nginx HTTP'

ufw allow 'Nginx HTTP' 
Run Code Online (Sandbox Code Playgroud)


小智 5

我遇到了同样的问题..结果由于某种原因没有安装 Nginx。所以它只显示了 OpenSSH

sudo ufw app list
Run Code Online (Sandbox Code Playgroud)

当我尝试使用命令卸载 Nginx 时,我遇到了这个问题

sudo apt-get remove nginx
Run Code Online (Sandbox Code Playgroud)

输出显示如下: Package 'nginx' is not located, so not returned

现在你必须尝试使用​​命令再次安装 Nginx

sudo apt update
sudo apt install nginx
sudo ufw app list
Run Code Online (Sandbox Code Playgroud)

现在选项将可用 // 检查以查看可用的应用程序: Nginx Full Nginx HTTP Nginx HTTPS OpenSSH

现在使用以下命令允许 HTTP 端口:

sudo ufw allow 'Nginx HTTP'
Run Code Online (Sandbox Code Playgroud)

最后运行这个命令:

sudo ufw enable
Run Code Online (Sandbox Code Playgroud)

现在在浏览器中点击 URL,它将显示 Nginx 默认页面。