How to Reinstall apache2 properly in Debian/Ubuntu

Attention: open in a new window. PDFPrintE-mail

 

 

If you have issues with apache2 and you want to reinstall it but you are getting errors,then here it isthe solution for you.

i had an issue with apache, when i tried to start it i got this error message.

 /etc/init.d/apache2   start.: 45: Can't open /etc/apache2/envvars

i need to remove it completely.To do that i will use this command :

 sudo apt-get remove --purge apache2 apache2-utils
This command will completely remove all apache2 configuration files and directories.
- Reinstall again apache using the normal command
sudo apt-get install apache2

check your apache2
dpkg -l | grep apache2