nginx误删在缓存中获取配置文件信息
-
参考地址:Dump nginx config from running process?
一定保证nginx服务不重启
处理方案:
# 获取nginx PID 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 strings mem_* | grep worker_connections mem_* strings mem_* | grep server_name mem_* # 获取全部 --从文本中手动提取配置信息--过程可能漫长 strings mem_* > newfile.txt