色偷偷91综合久久噜噜-色偷偷成人-色偷偷尼玛图亚洲综合-色偷偷人人澡久久天天-国内精品视频一区-国内精品视频一区二区三区

Hello! 歡迎來到小浪云!


centos誤刪nginx.conf文件恢復(fù)方式


avatar
小浪云 2024-07-07 192


當你不小心誤刪或者錯誤操作導(dǎo)致nginx.conf文件丟失,而且nginx處于在運行的狀態(tài),在這種情況下我們就可以在內(nèi)存中獲取配置文件。

1.獲取nginx進程pid

ps -ef | grep nginx

你會得到如下輸出,找到master的pid

root     19812     1  0 5月10 ?       00:00:00 nginx: master process /usr/sbin/nginx

nginx    19813 19812  0 5月10 ?       00:00:26 nginx: worker process

nginx    19814 19812  0 5月10 ?       00:00:33 nginx: worker process

nginx    19815 19812  0 5月10 ?       00:01:15 nginx: worker process

nginx    19816 19812  0 5月10 ?       00:00:55 nginx: worker process

nginx    19817 19812  0 5月10 ?       00:00:04 nginx: cache manager process

root     26171 12446  0 12:56 pts/0    00:00:00 grep –color=auto nginx

如上所示,nginx的主要進程pid為19812

2.查找內(nèi)存映射

安裝gdb工具

yum install gdb -y

接下來我們需要檢查進程正在使用哪些內(nèi)存映射

cat /proc/19812/maps | grep heap

[root@loghub-server tmp]# cat /proc/19812/maps | grep heap

55e0e6760000-55e0e69c2000 rw-p 00000000 00:00 0                          [heap]

可以看到有2處地方,我們只需要關(guān)注heap部分。內(nèi)存位于55e0e6760000-55e0e69c2000之間。

3.轉(zhuǎn)儲

然后需要轉(zhuǎn)儲

gdb -p 19812

你會得到一個(gdb)提示?,F(xiàn)在在這個提示下使用我們之前記下的地址,地址前需要加0x

(gdb) dump memory /tmp/nginx-memory 0x55e0e6760000 0x55e0e69c2000

4.從轉(zhuǎn)儲中獲取字符串數(shù)據(jù)

strings  /tmp/nginx-memory > /tmp/nginx-memory.str

5.查找 nginx 配置

現(xiàn)在有了內(nèi)存轉(zhuǎn)儲。大多數(shù)配置都會有http {一行,現(xiàn)在可以測試下/tmp/nginx-memory.str

grep -A 20 “http {” /tmp/nginx-memory.str

[root@loghub-server tmp]# grep -A 50 “http {” /tmp/nginx-memory.str 

http {

    log_format  main  ‘$remote_addr – $remote_user [$time_local] “$request” ‘

                      ‘$status $body_bytes_sent “$http_referer” ‘

                      ‘”$http_user_agent” “$http_x_forwarded_for“‘;

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;

    tcp_nopush          on;

    tcp_nodelay         on;

    keepalive_timeout   65;

    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;

    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d Directory.

    # See http://www.landui.com/en/docs/ngx_core_module.html#include

    # for more information.

    include /etc/nginx/conf.d/*.conf;

    #proxy_temp_path  /etc/nginx/temp_dir;

    #proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=imgcache:100m inactive=1d max_size=1g;

    #proxy_cache_path /etc/nginx/cache_dir levels=1:2 keys_zone=imgcache:500m max_size=1g inactive=1d use_temp_path=off;

    proxy_cache_path /etc/nginx/conf.d/cache levels=1:2 keys_zone=my_zone:100m inactive=3600s max_size=1g;

復(fù)制出來修改下格式就可以了。

相關(guān)閱讀

主站蜘蛛池模板: 日韩欧美在线视频 | 久章草在线 | 日韩免费高清一级毛片久久 | 曰批免费视频播放免费观看网站 | 免费人成综合在线视频 | 在线观看色视频网站 | 97se狠狠狠综合亚洲狠狠 | 国产精品一二三区 | 韩日一区二区三区 | 国产精品29页 | 最好韩国日本高清 | 女人18毛毛片一级毛片 | 天天透天天 | 日韩高清在线二区 | 伊人免费视频二 | 乱色伦图片区 | 亚洲综合激情丁香六月 | 美国三级日本三级久久99 | 成人网18免费下 | 久久亚洲国产精品一区二区 | 黄色片视频在线观看 | 欧美日韩 国产区 在线观看 | 激情婷婷 | 激情综合五月亚洲婷婷 | 精品国产成人系列 | 香港三级日本三级a视频 | 亚洲国产欧美精品一区二区三区 | 99久久综合狠狠综合久久男同 | 久久伊人五月天 | 狠狠色噜噜狠狠狠狠米奇7777 | 免费一看一级毛片 | 天天综合网网欲色 | 99久久精品国产免看国产一区 | 激情综 | 国产91色综合久久免费分享 | 色网站免费在线观看 | 97久久综合九色综合 | 免费观看很色大片视频 | 日韩一区二区三区不卡 | 欧美激情在线播放一区二区三区 | 天天摸天天做天天爽天天弄 |