How to remove nginx and re activate apache?
First, you need to stop nginx
so it releases port 80 so that apache2
can listen to it later on.
sudo service nginx stop
Next, if nginx
was installed with apt-get
, it can be removed by running one of the following two commands (I explained the difference in the next paragraph).
sudo apt-get remove nginx
Or
sudo apt-get purge nginx
Both of them remove all package files, while the second also removes the configuration files that package had installed.
If you intend to use nginx
later on with the configuration you did, use remove
. Else, I would suggest using purge
.
After removing nginx
, you can restart apache
to make sure it is listening to port 80.
sudo apache2ctl restart
If you had removed apache
before installing nginx
, you can re-install it with
sudo apt-get install apache2
if after that the Welcome to nginx! page appears you can try unistall other version on nginx existing on your server with
sudo apt-get remove nginx-*
and
sudo apt-get purge nginx-*
Remove all nginx packages
sudo apt-get autoremove nginx
sudo apt-get purge nginx
This works for me
sudo service apache2 restart