Star / Stop / Restart Apache 2 Web Server

by Vivek Gite on April 6, 2008 · 10 comments

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

Featured Articles:

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

{ 10 comments… read them below or add one }

1 test November 5, 2009

or try this: invoke-rc.d apache2 restart

Reply

2 sudhakara.alva January 1, 2010

reset apache.404 not found

Reply

3 Anonymous June 17, 2010

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

Reply

4 Vivek Gite June 17, 2010

For Redhat use:

/etc/init.d/httpd restart

Reply

5 tipster February 9, 2011

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

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

Reply

7 alex September 28, 2011

remove the leading $ sign

Reply

8 ob1 May 8, 2011

service httpd start|stop|restart|status

Reply

9 pc-moon August 1, 2011

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

Reply

10 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 2 + 15 ?
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: