≡ Menu

Restart Httpd Server

Q. I’m using CentOS / RHEL / Fedora Linux server and I’d like to restart my httpd server after making some changes to httpd.conf file. How do I restart httpd?

A. You can use service command to restart httpd. Another option is use /etc/init.d/httpd service script.

Login as root user and type the following commands:

Task: Start httpd server:

# service httpd start

Task: Restart httpd server:

# service httpd restart

Task: Stop httpd server:

# service httpd stop
Please note that restart option is a shorthand way of stopping and then starting the Apache HTTPd Server. You need to restart server whenever you make changes to httpd.conf file. It is also good idea to check configuration error before typing restart option:
# httpd -t
# httpd -t -D DUMP_VHOSTS

Sample output:

Syntax OK

Now restart httpd server:
# service httpd restart

  • -t : Run syntax check for config files
  • -t -D DUMP_VHOSTS : Run syntax check for config files and show parsed settings only for vhost.

/etc/init.d/httpd script

You can also use following command:
# /etc/init.d/httpd restart
# /etc/init.d/httpd start
# /etc/init.d/httpd stop

A note about Debian / Ubuntu Linux

Type the following command under Debian / Ubuntu Linux:
# /etc/init.d/apache2 restart
# /etc/init.d/apache2 stop
# /etc/init.d/apache2 start

You can also use service command under Debian / Ubuntu Linux:
# service apache2 restart
# service apache2 stop
# service apache2 start

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:

{ 8 comments… add one }
  • Aji Prabowo March 31, 2011, 5:29 am

    great resource. Thank you for helping us out.


  • Halloween Sinatra December 4, 2011, 2:59 pm

    sysvconfig deb pkg is now not available for Debian Squeeze!
    Anyone tried the old lenny stable v0,81 on squeeze?

  • masoud January 31, 2013, 9:24 am

    and about CentOS we use this

    /sbin/service httpd start

  • Tejvir June 1, 2013, 8:20 am

    Thanks a lot man!!!! It really helped me a lot!!!

    Thank you!!

  • sravan December 17, 2013, 6:49 am

    Not able to start httpd service, because of following error..

    [root@cate4-br1-pc3 ~]# service httpd start
    Starting httpd: httpd: Could not determine the server’s fully qualified domain name, using for ServerName
    (30)Read-only file system: httpd: could not open error log file /etc/httpd/logs/error_log.
    Unable to open logs

    • Mine July 7, 2015, 4:27 pm

      You install httpd?
      # sudo yum install httpd

  • Orestis April 7, 2015, 10:13 am

    i am typing “/etc/init.d/httpd start” in terminal of centos 7 and gets me an error saying
    “-bash: /etc/init.d/httpd: No such file or directory”

    • yawe April 13, 2015, 7:42 pm

      Hello Orestis,
      check first if http is installed, if not then install it

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , ,