单机部署Wordpress WeCenter
# 创建nginx_php
mkdir nginx_php
# 进入到目录
cd nginx_php
# 下载tgz压缩包
把nginx_php.tgz拖入目录下
# 解压并安装nginx和php
tar xf nginx_php.tgz
yum localinstall -y *.rpm
# 安装数据库
yum install -y mariadb-server
# 创建www用户和组
groupadd www -g 666
useradd www -u 666 -g 666 -s /sbin/nologin/ -M
# 修改配置文件
vim /etc/nginx/nginx.conf
user www;
vim /etc/php-fpm.d/www.conf
user = www
group = www
# 启动服务
systemctl start nginx php-fpm mariadb
# 端口检测
[root@web03 nginx_php]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 7296/php-fpm: maste
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 7551/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7298/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 6707/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 6794/master
tcp6 0 0 :::22 :::* LISTEN 6707/sshd
tcp6 0 0 ::1:25 :::* LISTEN 6794/master
# 编写配置文件
## wordpress
vim /etc/nginx/conf.d/blog.conf
server{
listen 80;
server_name blog.xxx.com;
root /code/wordpress;
location / {
index index.php index.html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
# 复制配置文件
cp /etc/nginx/conf.d/blog.conf /etc/nginx/conf.d/zh.conf
# 编写配置文件
## zh
vim /etc/nginx/conf.d/zh.conf
server{
listen 80;
server_name zh.xxx.com;
root /code/zh;
location / {
index index.php index.html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
# 创建站点目录
mkdir /code
# 部署代码
wget https://cn.wordpress.org/wordpress-5.0.3-zh_CN.tar.gz
wget http://test.driverzeng.com/Nginx_Code/WeCenter_3-2-1.zip
# 解压代码
unzip WeCenter_3-2-1.zip
tar xf wordpress-5.0.3-zh_CN.tar.gz
# 改名
mv WeCenter_3-2-1 zh
# 删除__MACOSX
rm -fr __MACOSX/
# 授权站点目录www
chown -R www.www /code/
# 数据库密码
mysqladmin -uroot password '123'
# 连接数据库
mysql -uroot -p123
# 创建库
create database wp charset utf8;
create database zh charset utf8;
# 查看数据库
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| wp |
| zh |
+--------------------+
# 重启服务
systemctl restart nginx php-fpm mariadb
# 域名解析
10.0.0.7 blog.xxx.com zh.xxx.com




