This post shows you how to restore ‘apache2 directory‘ if you have accidentally removed it or modified some of its files like ‘000-default.conf‘ or any other file and now you want to restore it to its default state then you are at a right place.
I’m not making this post fatter and thinner one by adding a lot of theory and heavy amount of text. Just go straight forward and follow steps described as below.
Caution: We are using the word ‘restore’ in a loose sense, actually we will download the directory from the Ubuntu Application Repository not restore the deleted one. I am not providing any kind of guarantee if you mistakenly deleted your precious data or made any other harm for yourself by running the wrong commands instead. It would be all up to you and will be considered your mistake if something harmful happened for you by following this tutorial.
1. Remove the ‘apache2’ Directory
If you haven’t removed the ‘apache2‘ directory accidentally or deliberately then keep reading and follow this step. In case of you have deleted the ‘apache2′ directory then skip this step and go ahead to step 2.
Let’s get started! First of all you need to remove ‘apache2’ directory completely and permanently from your system. To do this run the following command which will remove the apache2 directory from the /etc/ directory:
sudo rm -R /etc/apache2
Cool, its simple enough!
2. Restore the ‘apache2’ Directory
Now, after removing the ‘apache2‘ directory permanently from the /etc/ directory we need to restore (download from Ubuntu Application Repository) this directory, run the following command in your terminal to restore it:
sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2
All is done, now just go back to your Files and you can see ‘apache2‘ directory exists in /etc/.
If you found this post useful then I think you must share it with your friends and/or colleagues. Tell them that you have solved your problem for which you sought help from them.
Having any problem? If you are facing some problems in this regard and are unable to restore ‘apache2‘ directory then please tell us the error you are encountering via comments and we’ll help you to overcome the problems and errors.