<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[nginx误删在缓存中获取配置文件信息]]></title><description><![CDATA[<p dir="auto">参考地址：<a href="https://serverfault.com/questions/361421/dump-nginx-config-from-running-process" rel="nofollow ugc">Dump nginx config from running process?</a></p>
<h3><strong>一定保证nginx服务不重启</strong></h3>
<p dir="auto">处理方案：</p>
<pre><code># 获取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"}' &gt; 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_* &gt; newfile.txt
</code></pre>
]]></description><link>http://an.forum.genostack.com/topic/1016/nginx误删在缓存中获取配置文件信息</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 09:38:46 GMT</lastBuildDate><atom:link href="http://an.forum.genostack.com/topic/1016.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Dec 2023 10:40:36 GMT</pubDate><ttl>60</ttl></channel></rss>