[GH-ISSUE #408] 控制nginx 的重启和重载无效果 #7355

Closed
opened 2026-03-12 20:16:05 +03:00 by kerem · 10 comments
Owner

Originally created by @en-o on GitHub (May 28, 2024).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/408

Describe the bug
控制nginx 的重启和重载无效果

To Reproduce
Steps to reproduce the behavior:

  1. nginx ConfigDir 关联原有的conf目录
  2. 在ui配置管理里编辑原有的配置
  3. 编辑之后重载nginx
  4. 重载/重启都不生效

Expected behavior

  1. 编辑配置后会生效
  2. location /demo -> demo2
  3. http://xx/demo2

Screenshots

功能点

image

nginx配置

image
image
image

nignx ui 是我代理出去的

image

Info (please complete the following information):

  • Server OS: centos7
  • Server Arch: amd64
  • Nginx UI Version: v2.0.0-beta.24
  • Your Browser: Chrome

Additional context
Add any other context about the problem here.

Originally created by @en-o on GitHub (May 28, 2024). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/408 **Describe the bug** 控制nginx 的重启和重载无效果 **To Reproduce** Steps to reproduce the behavior: 1. nginx ConfigDir 关联原有的conf目录 2. 在ui配置管理里编辑原有的配置 3. 编辑之后重载nginx 4. 重载/重启都不生效 **Expected behavior** 1. 编辑配置后会生效 2. location /demo -> demo2 3. http://xx/demo2 **Screenshots** ## 功能点 ![image](https://github.com/0xJacky/nginx-ui/assets/45027672/ef043450-b7e0-4aab-8b25-4b53991ef9b6) ## nginx配置 ![image](https://github.com/0xJacky/nginx-ui/assets/45027672/228cfb8b-587b-4f31-8a0f-6a929dda6691) ![image](https://github.com/0xJacky/nginx-ui/assets/45027672/743c1ccd-163d-4dbe-bc98-da79fd6f889c) ![image](https://github.com/0xJacky/nginx-ui/assets/45027672/770f01d7-d15c-4477-b7cc-29f4d81906aa) ## nignx ui 是我代理出去的 ![image](https://github.com/0xJacky/nginx-ui/assets/45027672/f4f95067-e2f7-4bc5-b9af-6cde7a6935d1) **Info (please complete the following information):** - Server OS: centos7 - Server Arch: amd64 - Nginx UI Version: v2.0.0-beta.24 - Your Browser: Chrome **Additional context** Add any other context about the problem here.
kerem closed this issue 2026-03-12 20:16:11 +03:00
Author
Owner

@0xJacky commented on GitHub (May 28, 2024):

发一下 nginx -V 的输出,也可以自己配置重载命令,还要看一下是不是因为权限的问题引起

<!-- gh-comment-id:2134409101 --> @0xJacky commented on GitHub (May 28, 2024): 发一下 nginx -V 的输出,也可以自己配置重载命令,还要看一下是不是因为权限的问题引起
Author
Owner

@en-o commented on GitHub (May 28, 2024):

发一下 nginx -V 的输出,也可以自己配置重载命令,还要看一下是不是因为权限的问题引起

[root@swdetabes bin]# nginx -V
nginx version: openresty/1.21.4.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.1.1n  15 Mar 2022 (running with OpenSSL 1.1.1s  1 Nov 2022)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.33 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.09 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.21 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --add-module=../ngx_stream_lua-0.0.11 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' --with-cc='ccache gcc -fdiagnostics-color=always' --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-stream --with-http_ssl_module


ReloadCmd 命令我配置了的没啥效果

<!-- gh-comment-id:2134478412 --> @en-o commented on GitHub (May 28, 2024): > 发一下 nginx -V 的输出,也可以自己配置重载命令,还要看一下是不是因为权限的问题引起 ```shell [root@swdetabes bin]# nginx -V nginx version: openresty/1.21.4.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.1.1n 15 Mar 2022 (running with OpenSSL 1.1.1s 1 Nov 2022) TLS SNI support enabled configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.33 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.09 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.21 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --add-module=../ngx_stream_lua-0.0.11 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' --with-cc='ccache gcc -fdiagnostics-color=always' --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-stream --with-http_ssl_module ``` ReloadCmd 命令我配置了的没啥效果
Author
Owner

@0xJacky commented on GitHub (May 28, 2024):

手动执行 restart / reload 命令的时候有什么输出吗

<!-- gh-comment-id:2134481297 --> @0xJacky commented on GitHub (May 28, 2024): 手动执行 restart / reload 命令的时候有什么输出吗
Author
Owner

@en-o commented on GitHub (May 28, 2024):

手动执行 restart / reload 命令的时候有什么输出吗

ui 上面的那个主动点击么。那个我看了日志和接口,就一个成功信息, 我自己手动在ssh控制台执行nginx -s reload 是正常的工作的

<!-- gh-comment-id:2134485018 --> @en-o commented on GitHub (May 28, 2024): > 手动执行 restart / reload 命令的时候有什么输出吗 ui 上面的那个主动点击么。那个我看了日志和接口,就一个成功信息, 我自己手动在ssh控制台执行nginx -s reload 是正常的工作的
Author
Owner

@0xJacky commented on GitHub (May 28, 2024):

你不是用 docker 安装的吧?

<!-- gh-comment-id:2134487180 --> @0xJacky commented on GitHub (May 28, 2024): 你不是用 docker 安装的吧?
Author
Owner

@en-o commented on GitHub (May 28, 2024):

你不是用 docker 安装的吧?
ui是用脚本安装的
nginx也是:按的 openresty

<!-- gh-comment-id:2134493494 --> @en-o commented on GitHub (May 28, 2024): > 你不是用 docker 安装的吧? ui是用脚本安装的 nginx也是:按的 openresty
Author
Owner

@0xJacky commented on GitHub (May 28, 2024):

这个问题我暂时没办法在现有环境复现,也许您可以补充关于这个问题的更多细节,比如 nginx 的安装方式和步骤,我有空时再虚拟机里试试,不过这个功能是直接调用的 exec.Command 函数,最多就是权限不够没法执行,但是如果你运行在 root 下呢还是这样,我可能得看看能不能复现才能给你答复

<!-- gh-comment-id:2134707845 --> @0xJacky commented on GitHub (May 28, 2024): 这个问题我暂时没办法在现有环境复现,也许您可以补充关于这个问题的更多细节,比如 nginx 的安装方式和步骤,我有空时再虚拟机里试试,不过这个功能是直接调用的 exec.Command 函数,最多就是权限不够没法执行,但是如果你运行在 root 下呢还是这样,我可能得看看能不能复现才能给你答复
Author
Owner

@0xJacky commented on GitHub (Jun 10, 2024):

我今天在 centos7 的虚拟机里,通过 nginx.org 的源安装最新版本 1.27 的 nginx,然后 nginx-ui 的 app.ini 配置重载命令为 systemctl restart nginx,是可以正常工作的,reload 也是可以正常工作的

image
<!-- gh-comment-id:2157887967 --> @0xJacky commented on GitHub (Jun 10, 2024): 我今天在 centos7 的虚拟机里,通过 nginx.org 的源安装最新版本 1.27 的 nginx,然后 nginx-ui 的 app.ini 配置重载命令为 systemctl restart nginx,是可以正常工作的,reload 也是可以正常工作的 <img width="570" alt="image" src="https://github.com/0xJacky/nginx-ui/assets/13096985/db36ab4c-d96f-4cbb-8eb0-12fcdd3d76c5">
Author
Owner

@0xJacky commented on GitHub (Jun 10, 2024):

但是我似乎注意到另一个细节,你在入口的 nginx.conf 中没有配置 include /etc/nginx/sites-available/*; 大概这就是真正的问题吧

或者在您的环境中应该是 /usr/local/openresty/nginx/sites-available/*;

<!-- gh-comment-id:2157889403 --> @0xJacky commented on GitHub (Jun 10, 2024): 但是我似乎注意到另一个细节,你在入口的 nginx.conf 中没有配置 include /etc/nginx/sites-available/*; 大概这就是真正的问题吧 或者在您的环境中应该是 /usr/local/openresty/nginx/sites-available/*;
Author
Owner

@0xJacky commented on GitHub (Jun 10, 2024):

附重启前后的 nginx.pid 变化

image
<!-- gh-comment-id:2157891162 --> @0xJacky commented on GitHub (Jun 10, 2024): 附重启前后的 nginx.pid 变化 <img width="312" alt="image" src="https://github.com/0xJacky/nginx-ui/assets/13096985/f72ce106-cbd1-4ea0-8adb-f27d6c93ff59">
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#7355
No description provided.