How to remove nginx and re activate apache?
Sebastian Wright
I have installed Apache2, mysql, php5 and phpmyadmin on my Ubuntu 14.04 but later on mistakenly I install nginx.
Now my localhost page show me Welcome to nginx server. And the localhost/phpmyadmin link is not working.
How can I get my LAMP server back?
i removed ngnix using command
sudo apt-get remove nginx
sudo apt-get purge nginxinstalling apache
sudo apache2ctl restartbut at the end on restarting apache2 i get this error
sudo apache2ctl restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
Action 'restart' failed. 3 4 Answers
First, you need to stop nginx so it releases port 80 so that apache2 can listen to it later on.
sudo service nginx stopNext, 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 nginxOr
sudo apt-get purge nginxBoth 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 restartIf you had removed apache before installing nginx, you can re-install it with
sudo apt-get install apache2 2 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 nginxThis works for me
sudo service apache2 restart In my case, using Deepin, I had to do more than
sudo apt-get remove nginx-*the execution of the
sudo apt-get autoremoveWhen I finished, I realized that
sudo apache2ctl restartthat the apache had also been removed. I reinstalled with the command
sudo apt-get install apache2And I restarted the service with
sudo service apache2 restart