linux - 从正在运行的 nginx 进程中转储 conf

标签 linux configuration process nginx dump

是否可以仅从正在运行的 nginx 进程中获取 nginx 正在使用的 conf?

获取conf文件路径。有时 ps aux 显示它,有时它不显示。它可能类似于 nginx: master process/usr/sbin/nginx (与 /proc/PID/cmdline 相同)

  1. 那么nginx -V是唯一的解决方案吗?
  2. 来自 this question ,是否可以直接从 nginx 进程中转储 conf 数据结构?或者至少转储 conf 文件路径?

最佳答案

从 Nginx 1.9.2 开始,您可以使用 -T 标志转储 Nginx 配置:

-T — same as -t, but additionally dump configuration files to standard output (1.9.2).

来源:http://nginx.org/en/docs/switches.html

这与特定进程的转储不同。如果您的 Nginx 使用不同的配置文件,请检查 ps aux 的输出并使用它提供的任何二进制文件,例如如果它给出类似的东西

nginx: master process /usr/sbin/nginx -c /some/other/config

你需要运行

/usr/sbin/nginx -c /some/other/config -T

如果您还没有使用 1.9.2,您可以使用 gdb 转储配置:

关于linux - 从正在运行的 nginx 进程中转储 conf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12832033/

相关文章:

c# - 过程监控

module - Erlang中的模块和进程之间有什么关系

c++ - 在启动特定子进程后挂起进程

linux - 如何通过管道给出参数杀死

linux - Web 服务的 Grass 命令

从 Windows 到 Linux 的 Python 代码

ssl - 如何在 Nginx 中为自定义位置设置双向 SSL?

linux 内核参数 'rootwait' 被忽略

linux - 如何在 IntelliJ IDEA 2017.1 中禁用鼠标中键单击粘贴?

ruby-on-rails - 如何从应用程序 Controller 中读取 ruby​​ on rails 配置值