【问题标题】:How can nginx be added to UFW, nginx is not appearing in the UFW lst?nginx怎么加到UFW,nginx没有出现在UFW lst中?
【发布时间】:2024-04-28 05:45:01
【问题描述】:

如何将 nginx 添加到 UFW。 nginx 没有出现在 UFW lst 中?

运行命令时: ufw app list

Nginx 没有出现在里面。 nginx如何加入UFW?

任何帮助将不胜感激?

【问题讨论】:

  • Nginx 是一个 Web 服务器,只需将 Nginx 将要侦听的端口列入白名单。最常见的一次是用于 SSL 的 80443。它不需要是 UFW 的已知应用。

标签: ubuntu nginx ufw


【解决方案1】:

很容易添加您自己的应用程序:

创建一个文件:

/etc/ufw/applications.d/nginx

内容如下:

[Nginx]
title=Nginx Web Server (HTTP + HTTPS)
description=Small, but very powerful and efficient web server
ports=80,443/tcp

告诉 ufw 新应用:

ufw app update Nginx

允许 Nginx:

ufw allow Nginx

【讨论】:

    最近更新 更多