需求:
根据企业需要,将配置Nginx实现动静分离,对php页面的请求转发给L AMP处理,而静态页面交给Nginx处理, 以实现动静分离
配置步骤分为三步:
1.配置Nginx处理动态页面请求,在server{};中加入
2.在Apache工作目录新建test.php
3.重启Nginx并测试
架设并配置LAMP环境:
yum install httpd httpd-devel -y
##使用yum安装架构
systemctl start httpd.service
##启动服务
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=http ##防火墙公共区域增加http协议
success
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=https ##防火墙公共区域增加https协议
success
[root@localhost ~]# firewall-cmd --reload
##重载防火墙
success
[root@localhost ~]# yum install mariadb mariadb-server mariadb-libs mariadb-devel -y
##使用yum安装MYSQL数据库,mariadb数据库管理系统是MYSQL数据库的分支
[root@localhost ~]# systemctl start mariadb
##启动数据库
[root@localhost ~]# mysql_secure_installation
##设置数据库
Enter current password for root (enter for none):
##此处但回车键