簡體   English   中英

添加或刪除或重新加載特定的 VirtualHost,而無需重新啟動 Apache(並中斷其他 VirtualHost 的請求)

[英]Add or remove or reload a specific VirtualHost without restarting Apache (and having other VirtualHosts' requests interrupted)

上下文:假設我有這個/etc/apache2/sites-available/000-default.conf文件(Debian 9,Apache 2.4):

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/html/site1
</VirtualHost>

並且一些客戶目前正在瀏覽該網站,甚至其中一些客戶正忙於在該網站上下載 1 GB 的文件(假設他們正在下載www.example.com/bigfile.zip )。

現在我想添加一個新的VirtualHost ,並將000-default.conf文件編輯到(並保存):

<VirtualHost *:80>
    ServerName example.com
    DocumentRoot /var/www/html/site1
</VirtualHost>

<VirtualHost *:80>
    ServerName example2.com
    DocumentRoot /var/www/html/site2
</VirtualHost>

現在如果我這樣做

service apache2 restart

它將成功啟用新網站example2.com ,但也會停止來自 example.com 的客戶端的所有正在進行的請求,並且它會中斷例如正在進行的下載。

問題:有沒有辦法添加新的VirtualHost而不會中斷其他VirtualHost正在進行的請求(長時間下載等)?

筆記:

重啟==停止,然后開始。

而是使用apachectl graceful Graceful 讓現有的連接完成,然后在每個子進程被釋放時一個一個地重新啟動它們。 新連接將獲得新配置。

https://httpd.apache.org/docs/2.4/stopping.html#graceful

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM