有办法把nginx配置文件导出来吗

270 views
Skip to first unread message

SJ Zhu

unread,
Mar 26, 2014, 1:31:15 AM3/26/14
to USTCLUG-Group
一不小心把nginx的conf文件清空了,重新写有点麻烦,有办法把配置文件从运行中的进程中导出来吗?
也就是说在没有nginx reload之前,nginx的配置文件是从哪里读的?还是说nginx一旦运行,worker是不会有新开的了,配置文件都是在内存中了?

Bojie Li

unread,
Mar 26, 2014, 2:02:58 AM3/26/14
to USTC_LUG
nginx 配置文件是“编译”成内部表示之后就关闭了,lsof 可以看到运行中的 nginx 进程没有打开配置文件。
只能尝试用 ext4undelete 之类的文件恢复工具了。不知是不是我的使用姿势不对,ext4 上误删除的文件能恢复的概率远远小于 NTFS 文件恢复的概率。


2014-03-26 13:31 GMT+08:00 SJ Zhu <zsj9...@gmail.com>:
一不小心把nginx的conf文件清空了,重新写有点麻烦,有办法把配置文件从运行中的进程中导出来吗?
也就是说在没有nginx reload之前,nginx的配置文件是从哪里读的?还是说nginx一旦运行,worker是不会有新开的了,配置文件都是在内存中了?

--
-- 来自USTC LUG
请使用gmail订阅,不要灌水。
更多信息more info:http://groups.google.com/group/ustc_lug?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "USTC_LUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ustc_lug+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Guo, Jiahua

unread,
Mar 26, 2014, 4:13:59 AM3/26/14
to ustc...@googlegroups.com
搜到一个,不知道有没有用。
看样子是把整个 memory 都 dump 下来了。


2014-03-26 13:31 GMT+08:00 SJ Zhu <zsj9...@gmail.com>:
一不小心把nginx的conf文件清空了,重新写有点麻烦,有办法把配置文件从运行中的进程中导出来吗?
也就是说在没有nginx reload之前,nginx的配置文件是从哪里读的?还是说nginx一旦运行,worker是不会有新开的了,配置文件都是在内存中了?

--

SJ Zhu

unread,
Mar 26, 2014, 4:28:40 AM3/26/14
to USTCLUG-Group
dump了内存里的东西,
至少能大致知道文件原来的样子。
要恢复还是只能重写了==

Aron Xu

unread,
Mar 26, 2014, 7:47:56 AM3/26/14
to ustc...@googlegroups.com
重写是王道,木有更好的办法……
Regards,
Aron Xu
Reply all
Reply to author
Forward
0 new messages