sjobe
sjobe

Reputation: 2837

Apache : Recover "sites-enabled" config files

I was cleaning up on one of my older servers when I realized that there was a lot of stuff in the "sites-available" config folder that wasn't being used, and since everything I needed and rarely modified was in the "sites-enabled" folder, I ran a "rm -rf *" on the "sites-available" folder...

BAD IDEA, it happens that the files in "sites-enabled" were actually symbolic links to the ones in "sites-available", the ones I just deleted.

The good news is that I haven't applied the changes or restarted apache yet, so all my sites are still up. Is there a way to recover these file from the currently running apache process ?

Upvotes: 1

Views: 1872

Answers (2)

Michael
Michael

Reputation: 51

If you have config files in sites-available that have similar ServerName, ServerAlias, etc. you may be able to reverse engineer the deleted files using the symbolic link names in sites-enabled, and with knowledge of the / structure in var/www/.

That assumes you have FTP/SFTP access to /etc/apache2/sites-available.

Upvotes: 2

Bastian
Bastian

Reputation: 10433

No. I don't think there is a way to get it from the running apache. You have to recover the files from your last backup.

There is "apachectl -S" but I think it checks the new config files for errors only and gives no information about the running process.

Upvotes: 0

Related Questions