在 CentOS 系统中,要启用 Apache2(通常称为 httpd)的模块,请按照以下步骤操作:
sudo yum install httpd
sudo systemctl start httpd
sudo systemctl enable httpd
a2enmod
命令。例如,要启用 mod_rewrite
模块,请执行以下命令:sudo a2enmod rewrite
mod_rewrite
和 mod_deflate
模块,请执行以下命令:sudo a2enmod rewrite deflate
sudo systemctl reload httpd
/etc/httpd/conf.modules.d/
目录下)中的 LoadModule
指令。您还可以使用以下命令查看已启用的模块列表:sudo apachectl -M
现在,您已经成功启用了所需的 Apache2 模块。