I made changes to the httpd.conf file. How do I reload the new config changes without restarting the Apache 2 web server under Debian / CentOS Linux operating systems?

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements apachectl/service/systemctl command on Linux/Unix
Est. reading time 1 minute
Yes, you can gracefully restart the Apache v1.x or v2.x httpd daemon under Linux or Unix like operating systems. You can send the following signals to httpd to start, restart, reload, or stop the server:
  1. start
  2. restart
  3. graceful
  4. stop
  5. graceful-stop

A note about graceful Apache webserver restart

You need to send USR1 signal to the Apache server:

This (USR1) signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they’re not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.

We can run a configuration file syntax test as follows:
apachectl configtest
apachectl -t

Related: 21 Examples To Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors

Command syntax to gracefully restart the Apache 1.x/2.x after changing config file

Type the following command as a root user:

apachectl -k graceful


apache2ctl -k graceful

Apache 2 Reload HTTPD Configuration File Without Restarting Apache When Using Systemd

The syntax is:
# CentOS/RHEL/Fedora Linux
sudo systemctl reload httpd
# Debian/Ubuntu Linux
sudo systemctl reload apache2

Reloading Apache web server config without restarting it

Older Linux disro commands to reload Apache server

You can also use Linux distro specific Sys V init script as follows to gracefully reload the server. The following example works on RHEL/CentOS Linux and friends only:

/etc/init.d/httpd graceful


/sbin/service httpd graceful

Debian / Ubuntu Linux and friends use the following syntax:

/etc/init.d/apache2 reload

Monitoring apache progress

After you have signaled Apache 2, you can read apache error_log file about its progress by issuing the following tail command:

## For RHEL / CentOS and friends ##
tail -f /var/log/httpd/error_log
## For  Debian / Ubuntu and friends ##
tail -f /var/log/apache2/error.log
## FreeBSD Unix ##
tail -f /var/log/httpd-error.log


You learned how to reload Apache 2 web server gracefully without restating it fully. In summary, we test for config files for error and then reload them:
apachectl configtest
apachectl -k graceful

apachectl command: available CLI options
apachectl command Description
-D name define a name for use in directives
-d directory specify an alternate initial ServerRoot
-f file specify an alternate ServerConfigFile
-C "directive" process directive before reading config files
-c "directive" process directive after reading config files
-e level show startup errors of level (see LogLevel)
-E file log startup errors to file
-v show version number
-V show compile settings
-h list available command line options (this page)
-l list compiled in modules
-L list available configuration directives
-t -D DUMP_VHOSTS show parsed vhost settings
-t -D DUMP_RUN_CFG show parsed run settings
-S a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES show all loaded modules
-M a synonym for -t -D DUMP_MODULES
-t -D DUMP_INCLUDES show all included configuration files
-t run syntax check for config files
-T start without DocumentRoot(s) check
-X debug mode (only one worker, do not detach)

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • BT Apr 29, 2013 @ 14:25

    Thanks for the helpful information. How would the graceful restart work if I have a password protected SSL Certificate and must type in a password every time I restart Apache?

  • Ben May 1, 2013 @ 19:10

    I would suggest checking the integrity of the modified config file before issuing the graceful restart. Without checking, your HTTPD server could stop running if it tries to load a config file with a syntax error.

    apachectl configtest


    apachectl graceful (The -k isn’t necessary)

  • liamg Jul 27, 2013 @ 18:22

    how we can do the same in Windows ?

  • Eshal Park Mar 11, 2021 @ 22:52

    @liamg: Are you asking this on a portal that is dedicated to Linux ?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum