Monday, December 12, 2011

Reset Apache2 on Ubuntu

Recently I was experimenting on apache2 and edited many config files. Soon I realised that PHP was not working properly on it. While installing joomla it was failing. So I removed apache2 using command:
     sudo apt-get purge apache2 
The problem was I didnt removed apache2 completely. Then I quicked googled and find out the correct way of getting it working back use following snippet.
APACHE_PKGS=`sudo dpkg --get-selections | grep apache | cut -f 1`
# Make sure things are sane:
echo $APACHE_PKGS
# Example output: apache2 apache2-mpm-prefork apache2-utils apache2.2-common \
# libapache2-mod-php5 libapache2-mod-python libapache2-svn
# Likely if you have a Python application:
# libapache2-mod-python libapache2-mod-python-doc libapache2-mod-wsgi
# Or if you roll with the PHP:
# libapache2-mod-php5
sudo apt-get remove --purge $APACHE_PKGS
# You might want to consider not re-installing the whole list;
# instead dump it out, audit, and install what you need:
sudo apt-get install $APACHE_PKGS
After this apache2 got resetted and working as it was freshly installed with all configurations replaced.
Reference : http://bit.ly/uBxq7L

No comments:

Post a Comment