J
J
JunDevTest2018-07-27 10:13:50
linux
JunDevTest, 2018-07-27 10:13:50

How to roll back changes in a Linux file or get a config from the Nginx cache?

Good day.
By negligence, I overwrote the configuration file of the host in Nginx (the string "test" was written to it), but the site itself still works on the old config (apparently). Is it possible to roll back changes in a file or get a config that is cached in Nginx memory?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2018-07-27
@JunDevTest

https://serverfault.com/questions/361421/dump-ngin...

E
Eugene, 2018-07-27
@immaculate

You need to make backups.
There is no way to rollback (in the general case, most likely in yours too).
I don't know if nginx keeps the config file open after startup (unlikely). You can use it to lsofsee if it keeps the file open, and if so, and if the overwriting happened by replacing the file, try to get the old file by inode number or through /proc(I won’t say exactly how offhand, but it’s possible). However, this is unlikely.
Second option: https://serverfault.com/questions/173999/dump-a-li...
You can try to dump the memory and hope that somewhere there are leftovers of the file. True, it is unlikely that they remained in nginx memory, it may be necessary to dump the entire server memory, but even then, it seems to me, it is unlikely that they can be found.
But it's worth a try.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question