Star / Stop / Restart Apache 2 Web Server

by on April 6, 2008 · 13 comments· last updated at March 6, 2010

How do I restart Apache 2 Web Server under Debian / Ubuntu Linux or UNIX operating systems?

Apache is primarily used to serve both static content and dynamic Web pages on the World Wide Web. Many web applications are designed expecting the environment and features that Apache provides.

First, login to server using ssh, if server is not in local data center:
ssh root@your.server.com
Once logged in type the following commands

Restart Apache 2 web server, enter:

# /etc/init.d/apache2 restart

If you are using Ubuntu use sudo:

$ sudo /etc/init.d/apache2 restart

To stop Apache 2 web server, enter:

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

To start Apache 2 web server, enter:

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



You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 13 comments… read them below or add one }

1 test November 5, 2009 at 7:45 pm

or try this: invoke-rc.d apache2 restart

Reply

2 sudhakara.alva January 1, 2010 at 6:11 am

reset apache.404 not found

Reply

3 Anonymous June 17, 2010 at 9:39 pm

Sorry, this doesn’t work on Red Hat:
/etc/init.d/apache2: command not found

Reply

4 Vivek Gite June 17, 2010 at 10:08 pm

For Redhat use:

/etc/init.d/httpd restart

Reply

5 tipster February 9, 2011 at 1:50 am

If you want to stop,start, restart apache2 in Debian give this a try after su’ing

/etc/init.d/apache2ctl stop
or start restart what ever

Reply

6 Hasnat April 11, 2011 at 9:09 am

Sorry, this doesn’t work on Debian:
/etc/init.d/apache2: command not found

Reply

7 alex September 28, 2011 at 4:54 pm

remove the leading $ sign

Reply

8 ob1 May 8, 2011 at 1:27 pm

service httpd start|stop|restart|status

Reply

9 pc-moon August 1, 2011 at 11:38 pm

okey what is mean when this message coming to u : No apache MPM package installed

Reply

10 Hemant Thorat January 3, 2012 at 6:04 am

sudo service apache2 restart

Reply

11 emmanuel March 22, 2012 at 3:45 am

hello there,

can someone help me out with how i can stop my apache from running.?

Reply

12 ivan March 25, 2012 at 11:52 am

run

/etc/init.d/apache2 stop

Reply

13 Fabio Tropia February 4, 2013 at 10:10 am

# service httpd restart
…is better!

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , , , ,

Previous Faq:

Next Faq: