天天看点

使用PolarDB和ECS搭建门户网站

1、 配置环境

LAMP环境:运行在Linux下的Apache 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

安装PHP:

安装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

启动SQL:

systemctl start mysqld

2、 搭建门户网站

安装Git:

yum -y install git

下载PbootCMS:

cd ~ && git clone

https://gitee.com/hnaoyun/PbootCMS.git

安装包拷贝到目录:

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数据库连接地址 –u用户名 –p用户密码 -Dpbootcms < $sql_file

修改CMS系统数据库配置:

cat > /var/www/html/config/database.php << EOF

<?php

return array(

'database' => array(
    'type' => 'mysqli', // 数据库连接驱动类型: mysqli,sqlite,pdo_mysql,pdo_sqlite
    'host' => '数据库连接地址', // PolarDB数据库链接地址
    'user' => 'test_user', // PolarDB数据库的用户名
    'passwd' => 'Password1213', // PolarDB数据库的密码
    'port' => '3306', // 数据库端口
    'dbname' => 'pbootcms' //数据库名称
)           

);

EOF

在ECS中开放80端口

重启Apache服务:

systemctl restart httpd

公网IP进入门户网站首页