Apache: Make Changes In a Config File Take Effect Without Restarting Server

Q. How do I make changes in a Apache server config file to take effect without restarting the Apache server itself w/o interrupting users’ current session?

ADVERTISEMENTS

A. You can use httpd service or apachectl to reload configuration without interrupting users’ sessions as follows:

Login as root and type the following command
# /etc/init.d/httpd reload
OR
# apachectl -k graceful
This is also known as gracefully restarting the Apache httpd daemon. If the daemon is not running, it is started. This differs from a normal restart in that currently open connections are not aborted. A side effect is that old log files will not be closed immediately. This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig 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 jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
2 comments… add one
  • Juan Jan 7, 2009 @ 4:23

    If running Apache with daemontools you can do this by:
    svc -h /service/apache

  • darpan Feb 25, 2017 @ 9:49

    sudo service apache2 restart will do it.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.