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

前端 未结 5 1157
-上瘾入骨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:41

    If you are using Ubuntu server, you can use systemctl

    systemctl reload apache2
    
    0 讨论(0)
  • 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

    0 讨论(0)
  • 2021-01-29 22:58

    It should be possible using the command

    sudo /etc/init.d/apache2 reload
    

    I hope that helps.

    0 讨论(0)
  • 2021-01-29 23:05

    Do

    apachectl -k graceful
    

    Check this link for more information : http://www.electrictoolbox.com/article/apache/restart-apache/

    0 讨论(0)
  • 2021-01-29 23:06

    other way is:

    sudo service apache2 reload
    
    0 讨论(0)
提交回复
热议问题