Ubuntu Linux Start / Restart / Stop Apache Web Server

by Vivek Gite on February 6, 2008 · 12 comments

How do I start, restart or stop Apache 2 web server under Ubuntu Linux operating systems?

/etc/init.d/apache2 is service script used to start / stop / restart the Apache2 service under Debian or Ubuntu Linux. You need to login as root or use sudo command restart Apache.

Task: Start Apache 2 Server

# /etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start

Task: Restart Apache 2 Server

# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart

Task: Stop Apache 2 Server

# /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 12 comments… read them below or add one }

1 gzip June 25, 2009

Edit ~/.bash_profile and add:
alias apache='sudo /etc/init.d/apache2'

Then it’s just apache start, apache restart, etc.

Reply

2 Ricardo Soares de Lima February 2, 2010

Thanks for the tip. It worked like a charm.

Reply

3 Marco March 18, 2010

thanks man

Reply

4 pingloopback November 4, 2010

These cmd line works great!!!!

Reply

5 John December 14, 2010

Here is what works for me:

/etc/rc.d/init.d/httpd (space) start

or

/etc/rc.d/init.d/httpd (space) stop

Reply

6 man February 27, 2011

nice tutorials,
is there a way to run the apache server as services just like in xampp?
Thanks,
man

Reply

7 ffadly April 7, 2011

wohooooooo,,,, good tutorial ,,, 4 thumbs ^_^

Reply

8 murugesh June 7, 2011

it s not workin for me….
the result is
sudo: /etc/init.d/apache2 commad not found
pls help me guys

Reply

9 unnikrishnan June 28, 2011

sudo /etc/init.d/apache2 do not put that column after sudo

Reply

10 blog for note June 10, 2011

i has stop my apache server, but another connections still establish

unix 3 [ ] STREAM CONNECTED 14940 /tmp/orbit-username/

Reply

11 MaurĂ­lio August 17, 2011

I’m from Brazil, and your tip helped me a lot, thanks!

Reply

12 Hemant Thorat January 3, 2012

sudo service apache2 restart

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 15 + 12 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: