目录
一、准备环境
bash
iptables -F #清空防火墙规则
systemctl stop firewalld #关闭防火墙
setenforce 0 #关闭核心防护
systemctl disable firewalld #设置开机不自启

二、安装apache组件
bash
yum install -y httpd #安装apache服务
systemctl start httpd #启动apache服务
systemctl status httpd #查看服务状态

三、安装mysql组件
bash
yum install -y mariadb-server mariadb #安装mysql数据库
systemctl start mariadb #启动服务
systemctl status mariadb #查看服务状态
mysql -uroot -p #登录数据库,刚安装没有密码
show databases; #查询所有库
exit #退出mysql




四、安装php组件
bash
yum -y install \
gd \
libjpeg libjpeg-devel \
libpng libpng-devel \
freetype freetype-devel \
libxml2 libxml2-devel \
zlib zlib-devel \
curl curl-devel \
openssl openssl-devel #准备安装环境
yum install -y php php-fpm php-mysql #安装php服务
vim /etc/httpd/conf/httpd.conf #修改apache配置文件
TypesConfig /etc/mime.types #添加四行配置
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
vim /var/www/html/index.php #简单的php脚本
<meta charset=utf8>
首页,新的,您好
<?php
phpinfo();
?>
systemctl restart httpd #重新启动apache服务





五、浏览器访问
bash
172.16.114.60:80
