在 CentOS 系統中,Apache2 通常被稱為 httpd
sudo yum install httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo apachectl -M
LoadModule
指令。例如,要加載 mod_rewrite
模塊,請編輯 Apache 配置文件(通常位于 /etc/httpd/conf/httpd.conf
或 /etc/httpd/conf.d/
目錄下的某個文件):sudo vi /etc/httpd/conf/httpd.conf
LoadModule
指令部分,然后添加以下行以加載所需的模塊(以 mod_rewrite
為例):LoadModule rewrite_module modules/mod_rewrite.so
保存并關閉配置文件。
重新啟動 Apache 服務以使更改生效:
sudo systemctl restart httpd
現在,所選模塊應已加載并準備好使用。您可以通過再次運行 sudo apachectl -M
命令來驗證模塊是否已成功加載。