公有云上云

wordpress上云

1、创建数据库

在云数据库rds上创建一个名为wordpress数据库与配置wordpress的wp-config.php文件数据库名称一致。点击确定创建即可。

2、配置nginx服务

在node1节点上使用yum命令安装nginx服务并启动
[root@chinaskill-node-0001 ~]# yum install nginx -y
[root@chinaskill-node-0001 ~]# systemctl start nginx && systemctl enable nginx

在node2节点上也安装nginx同node1

在node1上修改nginx配置文件,使nginx支持php服务,修改完检查并重启服务。

[root@chinaskill-node-0001 ~]# vim /etc/nginx/nginx.conf
        location / {
                root /usr/share/nginx/html;
                index index.php index.html index.html;

        }

        location ~ \.php$ {

                root    /usr/share/nginx/html;
                fastcgi_pass    127.0.0.1:9000;
                fastcgi_index   index.php;
                fastcgi_param   SCRIPT_FILENAME

$document_root$fastcgi_script_name;
                include         fastcgi_params;
                index index.php index.html index.html;

        }
[root@chinaskill-node-0001 ~]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@chinaskill-node-0001 ~]# systemctl restart nginx

在node2上修改nginx同node1

3.配置php服务

在node1上使用yum安装php服务,修改php服务的配置文件中运行用户和组为nginx,并启动。

[root@chinaskill-node-0001 ~]# yum install php-fpm php-mysql -y
[root@chinaskill-node-0001 ~]# vim /etc/php-fpm.d/www.conf 

; RPM: apache Choosed to be able to access some dir as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx

systemctl start php-fpm && systemctl enable php-fpm

在node2上安装php服务同node1

4.部署wordpress应用

将wordpress-5.0.2-zh_CN.tar.gz上传到node1的/root目录下并解压

[root@chinaskill-node-0001 ~]# tar -zxvf wordpress-5.0.2-zh_CN.tar.gz

删除nginx服务目录下/usr/share/nginxhtml中默认页面文件,将解压的wordpress目录上传到/usr/share/nginx/中并赋予给777权限。

[root@chinaskill-node-0001 ~]# rm -rfv /usr/sharenginx/html/*
[root@chinaskill-node-0001 ~]# cp -r /root/wordpress/* /usr/share/nginx/html/
[root@chinaskill-node-0001 ~]# chmod 777 /usr/share/nginx/html/*

在/usr/share/nginx/html目录下,可以看见一个wp-config-sample.php配置文件,该文件是wordpress应用一共了一个配置文件,将改模板复制一份并命名为wp-config.php,然后编辑该文件,配置wordpress应用访问数据库,数据库为云数据库地址。

[root@chinaskill-node-0001 ~]# cp -r /usr/share/nginx/html/wp-config-sample.php /usr/share/nginx/html/wp-config.php
[root@chinaskill-node-0001 ~]# vim /usr/share/nginx/html/wp-config.php 

在node2上部署wordpress同上

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

花小智

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值