华为云使用RDS,ECS创建wordpress(个人笔记)

参考文档:https://support.huaweicloud.com/bestpractice-ecs/zh-cn_topic_0135015337.html

 购买ECS,centos7.6镜像,vpc要和RDS一样

购买RDS,vpc要和ECS的一样

登录ECS

安装Nginx。

  1. 登录弹性云服务器。
  2. 执行以下命令,下载对应当前系统版本的Nginx包。

    wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

  3. 执行以下命令,建立Nginx的yum仓库。

    rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

  4. 执行以下命令,安装Nginx。

    yum -y install nginx

  5. 执行以下命令,启动Nginx并设置开机启动。

    systemctl start nginx

    systemctl enable nginx

  6. 查看启动状态。

    systemctl status nginx.service

跳过安装sql 

安装PHP。

  1. 依次执行以下命令,安装PHP 7和一些所需的PHP扩展。

    rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

    yum -y install php70w-tidy php70w-common php70w-devel php70w-pdo php70w-mysql php70w-gd php70w-ldap php70w-mbstring php70w-mcrypt php70w-fpm

  2. 执行以下命令,验证PHP的安装版本。

    php -v

 

  1. 执行以下命令,启动PHP服务并设置开机自启动。

    systemctl start php-fpm

    systemctl enable php-fpm

  2. 执行以下命令打开配置文件/etc/nginx/conf.d/default.conf。

    vim /etc/nginx/conf.d/default.conf

  3. 添加红色部分server {
        listen       80;
        server_name  localhost;

        #access_log  /var/log/nginx/host.access.log  main;

        location / {
            root   /usr/share/nginx/html;
            index  index.php index.html index.htm;
        }
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
            include        fastcgi_params;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}
     

  4. 执行以下命令,重新载入nginx的配置文件。

    service nginx reload

在/usr/share/nginx/html目录下创建“info.php”的测试页面。

  1. 执行以下命令创建并打开“info.php”的测试文件。

    vim /usr/share/nginx/html/info.php

  2. i键进入编辑模式。
  3. 修改打开的“info.php”文件,将如下内容写入文件。
    <?php
     phpinfo();
    ?>
  4. 使用浏览器访问“http://服务器IP地址/info.php”,显示如下页面,说明环境搭建成功。

安装wordpress服务 

切换目录

cd /usr/share/nginx/html  

  打开官网链接https://wordpress.org/download/releases/

光标移动到要下载的版本压缩包上面复制链接(这里下载最新版本,tar解压的时候版本不一样要改版本号)

执行命令

wget 复制的链接

wget https://wordpress.org/wordpress-6.2.tar.gz 

 

  1. 执行以下命令,解压缩软件包。

    tar -xvf wordpress-6.2.tar.gz

    解压后生成一个“wordpress”的文件夹。

  2. 执行以下命令,设置解压后的文件权限。

    chmod -R 777 wordpress

浏览器访问“http://服务器IP地址/wordpress”进入安装向导

 

 登录RDS创建一个名字叫wordpress数据库

回到安装向导,按Let‘s go 如图输入信息,username是自定义的建议使用(root,admin)

 后面的乱按就行

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值