在Apache2中,啟用或禁用模塊的過程相對簡單。以下是一些基本步驟:
使用a2enmod
命令:
module_name
替換為你想要啟用的模塊名稱):sudo a2enmod module_name
mod_rewrite
模塊,可以輸入:sudo a2enmod rewrite
檢查模塊是否已啟用:
sudo apache2ctl -M
apachectl -M | grep module_name
重啟Apache服務:
sudo systemctl restart apache2
使用a2dismod
命令:
module_name
替換為你想要禁用的模塊名稱):sudo a2dismod module_name
mod_rewrite
模塊,可以輸入:sudo a2dismod rewrite
檢查模塊是否已禁用:
sudo apache2ctl -M
apachectl -M | grep module_name
重啟Apache服務:
sudo systemctl restart apache2
通過以上步驟,你可以輕松地在Apache2中啟用或禁用模塊。