在 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 命令来验证模块是否已成功加载。