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?


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


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

  • 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 '16 at 11:27
  • here is : askubuntu.com/questions/6358/how-do-you-restart-apache
    – dkb
    Dec 29 '16 at 11:31
  • I think it is the way to restart the server, where the server is already running. Dec 29 '16 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 '16 at 11:35

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
  • Don't I need to add '$sudo' before the command to start apache2? Dec 29 '16 at 11:30
  • If you are not logged in as root, then yes you have to add sudo. Sorry...
    – Thomas
    Dec 29 '16 at 16:45

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.