在 CentOS 上重启 Apache 服务,常用命令取决于你的 CentOS 版本以及 Apache 的服务名(通常是 httpd)。
sudo systemctl restart httpd
sudo systemctl start httpd # 启动
sudo systemctl stop httpd # 停止
sudo systemctl status httpd # 查看状态
sudo systemctl enable httpd
sudo service httpd restart
httpd -v
或
apachectl -v
ss -lntp | grep 80
sudo tail -f /var/log/httpd/error_log
sudo apachectl configtest
bt restart
lnmp restart
如果你不确定 CentOS 版本 或 Apache 安装方式,可以把下面命令的输出发给我:
cat /etc/os-release
systemctl status httpd