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
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.
-
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
-
-
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.– dkbDec 29, 2016 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, 2016 at 11:30
-
If you are not logged in as
root
, then yes you have to add sudo. Sorry...– ThomasDec 29, 2016 at 16:45