9

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 nginx

installing apache

sudo apache2ctl restart

but 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.
  • 1
    How did you install nginx? With apt-get? – Dan May 22 '14 at 18:06
  • yes i believe so – user284303 May 22 '14 at 18:07
  • I will add something to keep in mind here. /var/www/ and /var/www/html tend to be the 'default' docroot for web servers; if NGINX was installed before Apache it's entirely possible the 'default index page' that is installed by the web server is still present, and the system does NOT overwrite that when installing Apache or NGINX (in case the user actually has a custom page there). That may be why 'nginx' landing pages were being seen instead of Apache, so you should always check to make sure either no index.html is present or a custom one you wrote is present. – Thomas Ward Sep 22 '16 at 17:06
14

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
  • hi thankx for help i tried those two commands to remove nginx even though on localhost ot show nginx success page. not even/phpmyadmin workin – user284303 May 22 '14 at 18:23
  • question edited please have a look – user284303 May 22 '14 at 18:29
11

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-*

  • This is the solution in addition to sudo apt-get remove nginx. – garbagecollector Mar 16 '15 at 23:54
  • 1
    I still see Welcome page... – Blaszard Sep 22 '16 at 11:29
2

Remove all nginx packages

sudo apt-get autoremove nginx
sudo apt-get purge nginx

This works for me

sudo service apache2 restart
0

In my case, using Deepin, I had to do more than

sudo apt-get remove nginx-*

the execution of the

sudo apt-get autoremove

When I finished, I realized that

sudo apache2ctl restart

that the apache had also been removed. I reinstalled with the command

sudo apt-get install apache2

And I restarted the service with

sudo service apache2 restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.