0

I have the goal of starting and running a LAMP server with the goal of running a Drupal site, maybe Wordpress.

I haven't even gotten through the apache step. I used sudo apt-get install apache2-bin, which was suggested by terminal. Online recommends sudo apt-get install apache2, without the -bin.

$ apache2 -v 
Server version: Apache/2.4.7 (Ubuntu)

http://localhost/ yields; Unable to connect Firefox can't establish a connection to the server at localhost.

http://my-ip-address (from icanhazip.com) just thinks and thinks, completes nothing, blank page

$ sudo service apache2 restart
Apache2: unrecognised service
$ sudo apache2ctl graceful
sudo: apache2ctl: command not found
$ sudo /etc/init.d/apache2 reload
sudo: /etc/init.d/apache2: command not found
$ sudo start apache2
start: Unknown job: apache2
$ sudo restart apache2
restart; unknown job apache2

It seems installed, but not operational, any suggestions?

Thanks in advance...

Edit: I don't know what I am doing, so I will pretend I am at reddit. I solved this problem with a simple solution, of adding servername.conf, but then it didn't work again, backed up by purging and reloading, but I do not have enough reputation to say this. Thanks

3 Answers 3

3

It sounds a bit like some apache binaries might be missing.

sudo apt-get purge apache2*

that will remove all apache2 packages, then

sudo apt-get install apache2

As long as there are no errors through any of that then that should be fine. If you want to check apache is listening

sudo netstat -anop | grep apache

You should see apache listening on port 80. You can also check the status of apache2 by doing

sudo service apache2 status
2
  • Don't purge, just use the --reinstall option.
    – muru
    Jan 28, 2015 at 19:52
  • @muru that's an option also. Being that OP had tried a few things I felt it was wiser to purge everything and then just install apache2 (which obviously will install dependencies also) to make sure OP was starting from the right point with no other packages they don't actually need.
    – floodpants
    Jan 28, 2015 at 22:02
0

It is very simple to setup all you need to do is run the command:

sudo apt-get install apache2 mysql-server libapache2-mod-auth-mysql php5-mysql 

Once it is done open your browser and type localhost in the address bar.

8
  • perhaps this works, but I already installed apache2, and localhost is not displaying Apache default page ("it works") Jan 28, 2015 at 6:11
  • Pls just try reinstalling it. Jan 28, 2015 at 6:12
  • its not responding to sudo service apache2 restart, I don't know how to "reinstall" it. I just installed it tonight, although I had it installed in the past... Jan 28, 2015 at 6:14
  • Just rerun the command Jan 28, 2015 at 6:14
  • sudo apt-get install apache2 mysql-server libapache2-mod-auth-mysql php5-mysql Jan 28, 2015 at 6:15
0

You need to update first , Run the command

sudo apt-get update

Then reinstall Apache :

sudo apt-get install apache2

Then it will work

1
  • Not a correct answer see the --reinstall command.
    – David
    Feb 15, 2023 at 9:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .