天天看點

使用PolarDB和ECS搭建門戶網站使用PolarDB和ECS搭建門戶網站

使用PolarDB和ECS搭建門戶網站

連接配接ECS伺服器

1.打開windows cmd指令行輸入視窗
2.輸入 ssh [email protected]
3.輸入密碼,登入成功           

安裝LAMP環境

LAMP是指運作在Linux下的Apache、MySQL和PHP的環境。參考以下操作在雲伺服器上安裝開發環境。

1.安裝Apache服務及其擴充包

yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql           

2.安裝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           

3.安裝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           

搭建門戶網站

1.在ECS伺服器上安裝git

yum -y install git           

2.下載下傳PbootCMS源碼檔案

cd ~ && git clone https://gitee.com/hnaoyun/PbootCMS.git           

3.将安裝包拷貝到Apache的wwwroot目錄下

cp -r PbootCMS/* /var/www/html/           

4.修改站點根目錄檔案權限

chmod -R a+w /var/www/html           

5.向資料庫中導入CMS的初始資料

sql_file="/var/www/html/static/backup/sql/"$(ls /var/www/html/static/backup/sql/) &&
mysql -hpc-uf67p8qcrgmbdvvo6.rwlb.rds.aliyuncs.com -utest_user -pPassword1213 -Dpbootcms < $sql_file           

6.修改CMS系統資料庫配置

cat > /var/www/html/config/database.php << EOF
<?php
return array(
    'database' => array(
        'type' => 'mysqli', // 資料庫連接配接驅動類型: mysqli,sqlite,pdo_mysql,pdo_sqlite
        'host' => 'pc-uf67p8qcrgmbdvvo6.rwlb.rds.aliyuncs.com', // PolarDB資料庫連結位址
        'user' => 'test_user', // PolarDB資料庫的使用者名
        'passwd' => 'Password1213', // PolarDB資料庫的密碼
        'port' => '3306', // 資料庫端口
        'dbname' => 'pbootcms' //資料庫名稱
    )
);
EOF           

8.重新開機Apache服務

systemctl restart httpd