1

on my server (os : ubuntu 16) I have update my nginx configuration file by mastake then save and close the file , Is there away to get previous file before changes , hint: I havn't restart nginx on my server yet . I need help immediately

devops learn
  • 51
  • 1
  • 5

1 Answers1

1

Depends on your version of nginx.

See here: dump conf from running nginx process

in any case, you can dump the original nginx config-file with gdb.

Also, if you edited the file with a gnome software, there's a chance the config file backup is still there, under "filename~" (note the tilde at the end).

Or you can get the old inode from /proc/pid/fd (Linux keeps old used files in memory, until all processes using them exited - since nginx still runs, the inode is still there - inode or index node is the id of the file on the file system).

Stefan Steiger
  • 78,642
  • 66
  • 377
  • 442