[GH-ISSUE #153] 在centos8运行时,无法读取到本地已经安装的nginx #3185

Closed
opened 2026-02-28 11:54:55 +03:00 by kerem · 16 comments
Owner

Originally created by @guduyingkod on GitHub (Aug 10, 2023).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/153

报错信息:
2023-08-10 18:02:14 ERROR nginx/nginx.go:46 exec: "nginx": executable file not found in $PATH
2023-08-10 18:02:14 INFO server/server.go:25 Nginx config dir path:

$Path已验证存在nginx,并且nginx命令是可用的。
请问这个报错信息如何解决,目前是访问不了nginx ui的界面

Originally created by @guduyingkod on GitHub (Aug 10, 2023). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/153 报错信息: 2023-08-10 18:02:14 ERROR nginx/nginx.go:46 exec: "nginx": executable file not found in $PATH 2023-08-10 18:02:14 INFO server/server.go:25 Nginx config dir path: $Path已验证存在nginx,并且nginx命令是可用的。 请问这个报错信息如何解决,目前是访问不了nginx ui的界面
kerem 2026-02-28 11:54:55 +03:00
Author
Owner

@0xJacky commented on GitHub (Aug 10, 2023):

我看看能不能在虚拟机里复现一下,但是这个不影响访问的问题,建议检查一下端口是否被占用或者防火墙是否阻断端口

<!-- gh-comment-id:1673034484 --> @0xJacky commented on GitHub (Aug 10, 2023): 我看看能不能在虚拟机里复现一下,但是这个不影响访问的问题,建议检查一下端口是否被占用或者防火墙是否阻断端口
Author
Owner

@0xJacky commented on GitHub (Aug 10, 2023):

也可以手动指定 Nginx 配置的路径,这样就不会读这个命令

修改 app.ini
···
[nginx]
AccessLogPath = /var/log/nginx/access.log
ErrorLogPath = /var/log/nginx/error.log
ConfigDir =
PIDPath =
ReloadCmd =
RestartCmd =
···

<!-- gh-comment-id:1673036462 --> @0xJacky commented on GitHub (Aug 10, 2023): 也可以手动指定 Nginx 配置的路径,这样就不会读这个命令 修改 app.ini ··· [nginx] AccessLogPath = /var/log/nginx/access.log ErrorLogPath = /var/log/nginx/error.log **ConfigDir =** PIDPath = ReloadCmd = RestartCmd = ···
Author
Owner

@0xJacky commented on GitHub (Aug 10, 2023):

我刚用 CentOS 8 的镜像装了个虚拟机:https://mirrors.aliyun.com/centos/8/isos/x86_64

  1. 使用 yum install nginx 安装 nginx
  2. 使用脚本安装 nginx-ui
  3. 使用 systemctl stop firewalld.service 关闭防火墙
  4. 浏览器访问 http://ip:9000
  5. 检查环境变量
[root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

可以正常使用,且没有报错,您需要补充更多的信息以供我们复现 bug。

<!-- gh-comment-id:1673412132 --> @0xJacky commented on GitHub (Aug 10, 2023): 我刚用 CentOS 8 的镜像装了个虚拟机:https://mirrors.aliyun.com/centos/8/isos/x86_64 1. 使用 `yum install nginx` 安装 nginx 2. 使用脚本安装 nginx-ui 3. 使用 `systemctl stop firewalld.service` 关闭防火墙 4. 浏览器访问 http://ip:9000 5. 检查环境变量 ``` [root@localhost ~]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin ``` 可以正常使用,且没有报错,您需要补充更多的信息以供我们复现 bug。
Author
Owner

@guduyingkod commented on GitHub (Aug 11, 2023):

你好,大佬!我现在重试了一下确实可以看到nginx-ui页面,但是点击站点列表时报错:open : no such file or directory

<!-- gh-comment-id:1674155531 --> @guduyingkod commented on GitHub (Aug 11, 2023): 你好,大佬!我现在重试了一下确实可以看到nginx-ui页面,但是点击站点列表时报错:open : no such file or directory
Author
Owner

@guduyingkod commented on GitHub (Aug 11, 2023):

请问这里提到的app.ini 文件是在哪里可以找到?

<!-- gh-comment-id:1674159293 --> @guduyingkod commented on GitHub (Aug 11, 2023): > 请问这里提到的app.ini 文件是在哪里可以找到?
Author
Owner

@0xJacky commented on GitHub (Aug 11, 2023):

/usr/local/etc/nginx-ui/app.ini

<!-- gh-comment-id:1674164809 --> @0xJacky commented on GitHub (Aug 11, 2023): /usr/local/etc/nginx-ui/app.ini
Author
Owner

@guduyingkod commented on GitHub (Aug 11, 2023):

好的,已经修改了配置文件。目前报了这个错误
image
以下是当前nginx的配置文件
image
我应该新建这个缺失的文件/文件夹吗?

<!-- gh-comment-id:1674167196 --> @guduyingkod commented on GitHub (Aug 11, 2023): 好的,已经修改了配置文件。目前报了这个错误 ![image](https://github.com/0xJacky/nginx-ui/assets/112997197/8cdf22bd-f6ce-4612-bcc0-11654090faab) 以下是当前nginx的配置文件 ![image](https://github.com/0xJacky/nginx-ui/assets/112997197/192d1d71-cdca-4609-92f0-b56c8309cb07) 我应该新建这个缺失的文件/文件夹吗?
Author
Owner

@0xJacky commented on GitHub (Aug 11, 2023):

请查看中文文档 https://github.com/0xJacky/nginx-ui/blob/master/README-zh_CN.md#使用前注意

使用前注意
Nginx UI 遵循 Debian 的网页服务器配置文件标准。创建的网站配置文件将会放置于 Nginx 配置文件夹(自动检测)下的 sites-available 中,启用后的网站将会创建一份配置文件软连接到 sites-enabled 文件夹。您可能需要提前调整配置文件的组织方式。

对于非 Debian (及 Ubuntu) 系统,您可能需要将 nginx.conf 配置文件中的内容修改为如下所示的 Debian 风格。

http {
# ...
include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
;
}
更多信息请参阅:debian/conf/nginx.conf

<!-- gh-comment-id:1674171285 --> @0xJacky commented on GitHub (Aug 11, 2023): 请查看中文文档 https://github.com/0xJacky/nginx-ui/blob/master/README-zh_CN.md#使用前注意 使用前注意 Nginx UI 遵循 Debian 的网页服务器配置文件标准。创建的网站配置文件将会放置于 Nginx 配置文件夹(自动检测)下的 sites-available 中,启用后的网站将会创建一份配置文件软连接到 sites-enabled 文件夹。您可能需要提前调整配置文件的组织方式。 对于非 Debian (及 Ubuntu) 系统,您可能需要将 nginx.conf 配置文件中的内容修改为如下所示的 Debian 风格。 http { # ... include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } 更多信息请参阅:[debian/conf/nginx.conf](https://salsa.debian.org/nginx-team/nginx/-/blob/master/debian/conf/nginx.conf#L59-L60)
Author
Owner

@guduyingkod commented on GitHub (Aug 11, 2023):

好的,请问大佬是否能读取到之前已经配置在nginx.conf 里面的配置内容到nginx-ui?

<!-- gh-comment-id:1674172568 --> @guduyingkod commented on GitHub (Aug 11, 2023): 好的,请问大佬是否能读取到之前已经配置在nginx.conf 里面的配置内容到nginx-ui?
Author
Owner

@0xJacky commented on GitHub (Aug 11, 2023):

只能按照这个文件夹组织架构来

<!-- gh-comment-id:1674173787 --> @0xJacky commented on GitHub (Aug 11, 2023): 只能按照这个文件夹组织架构来
Author
Owner

@guduyingkod commented on GitHub (Aug 11, 2023):

酱紫,那就要手动迁移配置内容了

<!-- gh-comment-id:1674175164 --> @guduyingkod commented on GitHub (Aug 11, 2023): 酱紫,那就要手动迁移配置内容了
Author
Owner

@guduyingkod commented on GitHub (Aug 11, 2023):

image
请问这里应该怎么做才能让nignx-ui关联到nginx?

<!-- gh-comment-id:1674184810 --> @guduyingkod commented on GitHub (Aug 11, 2023): ![image](https://github.com/0xJacky/nginx-ui/assets/112997197/e61c32e3-e26d-44aa-abd2-94f906a0dd73) 请问这里应该怎么做才能让nignx-ui关联到nginx?
Author
Owner

@0xJacky commented on GitHub (Aug 11, 2023):

因为在你的环境下面 nginx 命令无法执行,所以你需要手动配置 pid 的路径
v2 以上的版本参考

修改 app.ini
···
[nginx]
AccessLogPath = /var/log/nginx/access.log
ErrorLogPath = /var/log/nginx/error.log
ConfigDir =
PIDPath =
ReloadCmd =
RestartCmd =
···

<!-- gh-comment-id:1674219750 --> @0xJacky commented on GitHub (Aug 11, 2023): 因为在你的环境下面 nginx 命令无法执行,所以你需要手动配置 pid 的路径 v2 以上的版本参考 修改 app.ini ··· [nginx] AccessLogPath = /var/log/nginx/access.log ErrorLogPath = /var/log/nginx/error.log ConfigDir = **PIDPath =** ReloadCmd = RestartCmd = ···
Author
Owner

@guduyingkod commented on GitHub (Aug 11, 2023):

好的 已经配置 感谢大佬

<!-- gh-comment-id:1674228377 --> @guduyingkod commented on GitHub (Aug 11, 2023): 好的 已经配置 感谢大佬
Author
Owner

@sonicno1 commented on GitHub (Aug 3, 2024):

include vhost/*.conf;的配置文件读取不到,nginx目录下无 sites-enabled 目录

<!-- gh-comment-id:2266811050 --> @sonicno1 commented on GitHub (Aug 3, 2024): include vhost/*.conf;的配置文件读取不到,nginx目录下无 sites-enabled 目录
Author
Owner

@0xJacky commented on GitHub (Aug 3, 2024):

include vhost/*.conf;的配置文件读取不到,nginx目录下无 sites-enabled 目录

请查看中文文档 https://github.com/0xJacky/nginx-ui/blob/master/README-zh_CN.md#使用前注意

使用前注意
Nginx UI 遵循 Debian 的网页服务器配置文件标准。创建的网站配置文件将会放置于 Nginx 配置文件夹(自动检测)下的 sites-available 中,启用后的网站将会创建一份配置文件软连接到 sites-enabled 文件夹。您可能需要提前调整配置文件的组织方式。

对于非 Debian (及 Ubuntu) 系统,您可能需要将 nginx.conf 配置文件中的内容修改为如下所示的 Debian 风格。

http {

...

include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/;
}
更多信息请参阅:debian/conf/nginx.conf

<!-- gh-comment-id:2266813648 --> @0xJacky commented on GitHub (Aug 3, 2024): > include vhost/*.conf;的配置文件读取不到,nginx目录下无 sites-enabled 目录 请查看中文文档 [https://github.com/0xJacky/nginx-ui/blob/master/README-zh_CN.md#使用前注意](https://github.com/0xJacky/nginx-ui/blob/master/README-zh_CN.md#%E4%BD%BF%E7%94%A8%E5%89%8D%E6%B3%A8%E6%84%8F) 使用前注意 Nginx UI 遵循 Debian 的网页服务器配置文件标准。创建的网站配置文件将会放置于 Nginx 配置文件夹(自动检测)下的 sites-available 中,启用后的网站将会创建一份配置文件软连接到 sites-enabled 文件夹。您可能需要提前调整配置文件的组织方式。 对于非 Debian (及 Ubuntu) 系统,您可能需要将 nginx.conf 配置文件中的内容修改为如下所示的 Debian 风格。 http { # ... include /etc/nginx/conf.d/.conf; include /etc/nginx/sites-enabled/; } 更多信息请参阅:[debian/conf/nginx.conf](https://salsa.debian.org/nginx-team/nginx/-/blob/master/debian/conf/nginx.conf#L59-L60)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#3185
No description provided.