首页 > 怎样从当前运行的 nginx 中读取 nginx.conf

怎样从当前运行的 nginx 中读取 nginx.conf

手贱把一个 conf.d 里面一个站点的配置文件内容给弄丢了
目前尝试恢复的方法如下 http://serverfault.com/questions/3614...

# Set pid of nginx master process here
pid=8192

# generate gdb commands from the process's memory mappings using awk
cat /proc/$pid/maps | awk '$6 !~ "^/" {split ($1,addrs,"-"); print "dump memory mem_" addrs[1] " 0x" addrs[1] " 0x" addrs[2] ;}END{print "quit"}' > gdb-commands

# use gdb with the -x option to dump these memory regions to mem_* files
gdb -p $pid -x gdb-commands

# look for some (any) nginx.conf text
grep worker_connections mem_*
grep server_name mem_*

不过拿到的2进制文件忒难看了, 有啥更简单的方式么?

【热门文章】
【热门文章】