❤️凌晨两点的夜晚很安静,早上五点的空气很迷人❤️ |
---|
企业常见网站架构
LAMP: Linux Apache mysql php
LNMP: Linux nginx mysql php
LMT: Linux mysql tomcat
这个实验我们采用的是LNMP环境
实验环境如下
虚拟机:CentOS7.8一台 PHP7.2 MySQL5.6
首先我们来搭建环境
- 安装nginx
yum -y install nginx
systemctl start nginx
- 安装mysql
rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server -y
systemctl start mysqld
systemctl enable mysqld
- 安装php
yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml
systemctl start php-fpm
systemctl enable php-fpm
- 查看服务端口是否开启
netstat -anput |grep 80
netstat -anput |grep 3306
netstat -anput |grep 9000
环境搭建好了之后我们需要上传WordPress的安装包,因为直接使用VMwareTools往进拖会导致不完整,我们这里使用Xshell来导入
- 搭建wordpress
(1)复制wordpress安装包,到CentOS/,解压并赋权
unzip wordpress-4.9.4-zh_CN.zip
chmod -R 777 /wordpress
(2)创建虚拟主机配置文件
vim /etc/nginx/conf.d/blog.conf
添加:
server {
listen 80;
server_name blog.benet.com;
root /wordpress;
index index.php index.html;
location ~ \.php$ {
root /wordpress;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
保存退出
systemctl reload nginx
(3)创建blog数据库和管理用户
mysql #登录数据库
create database blog; #创建数据库
grant all on blog.* to lisi@localhost identified by '123.com'; #设置管理用户及密码
(4)客户端通过域名/IP访问blog,安装并配置
http://192.168.8.10
登录后台
http://192.168.8.10/wp-admin
实验到这里就完成了!!!!!