Day4-基于PolarDB搭建门户网站

环境

System version: Centos7
Database: PolarDB

创建PolarDB数据库

  • 进入阿里云控制台首页, 进入云数据库PolarDB:
    Day4-基于PolarDB搭建门户网站
  • 点击左侧集群列表, 选择集群所在地点:
    Day4-基于PolarDB搭建门户网站
  • 进入集群的详情界面, 进行账号管理, 并创建账号:
    Day4-基于PolarDB搭建门户网站

Day4-基于PolarDB搭建门户网站

  • 创建数据库, 点击左侧的数据库管理, 并创建数据库:
    Day4-基于PolarDB搭建门户网站

Day4-基于PolarDB搭建门户网站

  • 设置数据库白名单, 点击集群白名单, 并点击设置:
    Day4-基于PolarDB搭建门户网站
  • 更改数据库监听的IP范围:
    Day4-基于PolarDB搭建门户网站

安装LAMP环境

  • 连接到Linux后, 通过下列命令安装Apache服务及其扩展包:
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
  • 安装PHP:
yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
  • 安装MySQL:
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
  • 启动MySQL数据库:
systemctl start mysqld
systemctl enable mysqld

搭建门户网站

  • 安装Git:
yum -y install git
  • 下载PbootCMS源码文件:
cd ~ && git clone https://gitee.com/hnaoyun/PbootCMS.git

CMS(content management system)管理系统: 被称为内容管理系统, 是指在一个合作模式下, 用于管理工作流程的一套系统. 而PbootCMS是全新内核且永久开源免费的PHP企业网站开发建设管理系统,是一套高效、简洁、 强悍的可免费商用的PHP CMS源码,能够满足各类企业网站开发建设的需要.

  • 将安装包拷贝到Apachewwwroot目录下:
cp -r PbootCMS/* /var/www/html/
  • 修改站点根目录文件权限:
chmod -R a+w /var/www/html
  • 数据库中导入CMS的初始数据:
sql_file="/var/www/html/static/backup/sql/"$(ls /var/www/html/static/backup/sql/) && mysql -h databaseAddress -u polardb_0 -p -D database0 < $sql_file

注意: 这里的-p参数后面不需要密码, 输入密码会导致明文错误

  • 修改CMS系统数据库配置:
cat > /var/www/html/config/database.php << EOF
<?php
return array(
    'database' => array(
        'type' => 'mysqli', // 数据库连接驱动类型: mysqli,sqlite,pdo_mysql,pdo_sqlite
        'host' => 'databaseAddress', // PolarDB数据库链接地址
        'user' => 'polardb_0', // PolarDB数据库的用户名
        'passwd' => 'Password', // PolarDB数据库的密码
        'port' => '3306', // 数据库端口
        'dbname' => 'database0' //数据库名称
    )
);
EOF
  • 配置ECS的本实例安全组:
    Day4-基于PolarDB搭建门户网站

添加入站规则:
Day4-基于PolarDB搭建门户网站

  • 重启Apache服务:
systemctl restart httpd

后台访问地址为http://ipaddress/admin.php, 账号默认为admin, 密码为123456:
Day4-基于PolarDB搭建门户网站
Day4-基于PolarDB搭建门户网站

上一篇:Day6-钉钉案例分享


下一篇:Win10强势,微软必应搜索广告业务增长21%