Question

So... I accidentally deleted the vhosts files in my sites-available folder.

I would like to get my vhosts back. Is there any way to get it from the currently running apache config? I have not restarted yet.

This person says no, but this was a few years ago.

Apache : Recover "sites-enabled" config files

Était-ce utile?

La solution

Remote disk recovery on a VPS -- here we go!

Remote disk recovery on a VPS

First, try:

lsof | grep /etc/apache2. If you see something like:

apache 1224 www-data 22r REG 8,5 1282410 1294349 /etc/apache2/sites-available/foo

you're in luck! From extundelete's website:

If you think the file may be still open by some program (for example, if it is a movie file currently being played by a movie player), and you know the filename, then first follow this procedure:

lsof | grep "/path/to/file"

progname 5559 user 22r REG 8,5 1282410 1294349 /path/to/file

Notice the number in the second column is 5559 and the number in the fourth column is 22. The command to restore that file is:

cp /proc/5559/fd/22 restored.file

If this doesn't work, well. Lots of people believe you are screwed. But I think there is hope!

Note that I rate this as a <50% chance of working, just to set expectations.

If you can't back up your disk over the network (not enough space, no access to another Linux box) you can try booting into Linode recovery mode and attempting extundelete on the disk directly. This risks data corruption, so don't do it if you really value the disk -- or, again, back it up first.

Of course -- nagging time -- the best solution is to have backups turned on in the first place.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top