How to reload apache configuration for a site without restarting apache?

前端 未结 5 1151
-上瘾入骨i
-上瘾入骨i 2021-01-29 22:20

I have edited the variable AllowOverride for one of my websites in sites-enabled directory. How do I reload the new configuration without restarting apache? I

5条回答
  •  北海茫月
    2021-01-29 22:45

    Updated for Apache 2.4, for non-systemd (e.g., CentOS 6.x, Amazon Linux AMI) and for systemd (e.g., CentOS 7.x):

    There are two ways of having the apache process reload the configuration, depending on what you want done with its current threads, either advise to exit when idle, or killing them directly.

    Note that Apache recommends using apachectl -k as the command, and for systemd, the command is replaced by httpd -k

    apachectl -k graceful or httpd -k graceful

    Apache will advise its threads to exit when idle, and then apache reloads the configuration (it doesn't exit itself), this means statistics are not reset.

    apachectl -k restart or httpd -k restart

    This is similar to stop, in that the process kills off its threads, but then the process reloads the configuration file, rather than killing itself.

    Source: https://httpd.apache.org/docs/2.4/stopping.html

提交回复
热议问题