3

I have installed LAMP stack on Ubuntu 14.04. Now I want to start apache2 server from terminal. What are the commands to do that?

2 Answers 2

5

Try executing following command

$sudo service apache2 restart|stop|start 

open the web browser and go to the URL http://localhost

if you read

"It works!"

message on browser

which is the content of the file

/var/www/index.html

this proves that Apache server has started and it is working. source.

4
  • I think '$sudo service apache2 restart' will restart the server. What if the server is down and I want to start it again.? Dec 29, 2016 at 11:27
  • here is : askubuntu.com/questions/6358/how-do-you-restart-apache
    – dkb
    Dec 29, 2016 at 11:31
  • I think it is the way to restart the server, where the server is already running. Dec 29, 2016 at 11:33
  • you can use any of the commands $sudo service apache2 start or $sudo service apache2 stop or $sudo service apache2 restart based on your need.
    – dkb
    Dec 29, 2016 at 11:35
1

To start the apache2 server from terminal run the command as follows.

sudo /etc/init.d/apache2 start

To make it start automatically at bootup, execute the command as follows.

sudo update-rc.d apache2 enable
2
  • Don't I need to add '$sudo' before the command to start apache2? Dec 29, 2016 at 11:30
  • If you are not logged in as root, then yes you have to add sudo. Sorry...
    – Thomas
    Dec 29, 2016 at 16:45

You must log in to answer this question.

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