Linux7安装Apache +PHP+MYSQL_云主机和虚拟主机_奇迪科技(深圳)有限公司(www.qvdv.net)

欢迎来到奇迪科技(深圳)有限公司,超值服务提供卓越产品!

云主机和虚拟主机

Linux7安装Apache +PHP+MYSQL

作者:qvdv 来源:qvdv 更新时间:2022-08-29

一、 安装Apcache,输入下面命令回车,很快就可以安装完成:

yum install -y httpd

1、 将Apache设置为自动启动:

systemctl enable httpd

执行命令后,你会看到类似的提示:from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

Apache的常用操作指令:

查看Apache状态:

systemctl status httpd.service

启动Apache:

systemctl start httpd.service

停止Apache:

systemctl stop httpd.service

重启Apache:

systemctl restart httpd.service

禁用Apache开机自动启动:

systemctl disable httpd.service

启用Apache开机自动启动:

systemctl enable httpd.service

2、 开放80端口

a、向防火墙添加一条规则,允许外部通过80端口访问:

firewall-cmd --add-service=http --permanent

如果你使用其他端口,例如8080端口,可以用以下命令:

firewall-cmd --zone=public --add-port=80/tcp --permanent

b、重启防火墙:

systemctl restart firewalld

c、这时候Apache的安装完成,我们可以通过IP或者域名访问Apache成功安装的默认页面,如下图:


Apache成功安装


本文版权所有,转载须注明:来源  https://www.qvdv.net/qvdv-zhuji-880.html