服务器环境

系统:Centos 7.4 x64
1台:web应用服务器
  1、准备PHP博客项目
  2、安装mysql数据库
  3、安装nginx服务
  4、安装php-fpm服务
1台:Jenkins服务器+git库服务器

准备工作

1、配置好服务器之前的SSH秘钥对认证。
2、提前下载好博客项目
  百度云:https://pan.baidu.com/s/1Cad-7sKVZ_gW7G7B6G2Gww
  密码:fpm0

web应用服务器:搭建博客项目环境

一、安装mariadb数据库

  • 数据库版本:mariadb-server.x86_64 1:5.5.64-1.el7

1、通过yum安装数据库

yum -y install mariadb-server

2、启动数据库

systemctl start mariadb

3、修改数据库root密码

mysqladmin -uroot password '123456'

4、登录数据库、并创建数据库

mysql -uroot -p123456
create database wordpress;
quit

二、安装nginx与php-fpm服务

  • 服务版本:nginx-1.16.1-1.el7.x86_64
  • 服务版本:php-fpm-5.4.16-46.1.el7_7.x86_64

1、通过yum安装nginx与php-fpm

# 安装扩展yum源
yum install epel-release -y
# 安装服务
yum install nginx php-fpm php-mysql

2、添加新的nginx配置文件
vim /etc/nginx/conf.d/web.conf

server {
    listen 8000;
    server_name 192.168.1.113;
    root /usr/share/nginx/html/web;
    index index.htm index.html index.php;
    location ~ \.php$ {
        root           /usr/share/nginx/html/web;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html/web$fastcgi_script_name;
        include        fastcgi_params;
    }
}
nginx 配置文件

相关文章: