在 CentOS 上啟用 Apache2(通常稱為 httpd)的步驟如下:
sudo yum install httpd
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd
如果服務正在運行,您將看到類似于以下的輸出:
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since ...
http://your_server_ip_or_domain
您應該看到 Apache 的默認頁面。
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
現在,您已經在 CentOS 上啟用了 Apache2。如有需要,請根據您的需求進行配置。