搭建服务器环境

1.创建数据库服务器

  • 关闭防火墙
systemctl stop firewalld 
setenforce 0
  • 下载数据库
yum -y install mariadb mariadb-server

搭建服务器环境

  • 开启数据库
systemctl start mariadb
  • 检测mariadb是否连通
mysql -uroot -p

在最后添加
搭建服务器环境

  • 重启数据库
systemctl restart mariadb

2.组建阿帕奇服务器

  • 关闭防火墙
systemctl stop firewalld 
setenforce 0
  • 下载httpd php php-mysql
    搭建服务器环境
  • 下载mariadb
    搭建服务器环境
  • 配置环境
vi index.php

搭建服务器环境

  • 连接数据库
mysql -h 192.168.1.156 -uroot -p

搭建服务器环境

  • 重启httpd
systemctl restart httpd

搭建服务器环境

3.创建nginx

  • 关闭防火墙
systemctl stop firewalld 
setenforce 0
  • 下载gcc-c++
yum -y install gcc-c++
  • 解压nginx zlib pcre安装包
tar -zxvf nginx-1.8.0.tar.gz
tar zxvf pcre-8.38.tar.gz 
tar zxvf zlib-1.2.8.tar.gz
  • 执行可执行文件nginx
cd nginx-1.8.0
./configure 
make
make install
  • 同上 执行可执行文件zlib pcre
cd /usr/local/nginx/
cd html/
vi index.html
cd conf/
vi nginx.conf
  • 重启nginx服务器
 ../sbin/./nginx -s reload

搭建服务器环境

#location / {
		        root   html;
		        index  index.html index.htm;
 #}
``