一、建立資源

二、建立PolarDB資料庫賬号
1.一鍵複制登入url。
2.依次單擊 産品與服務 > 雲資料庫PolarDB ,進入 雲資料庫PolarDB管理控制台 。
3.單擊左側 叢集清單 ,然後選擇雲産品資源提供的地域。
4.建立資料庫賬号。
5.建立資料庫。
6.設定資料庫白名單。
在白名單界面将預設的白名單位址127.0.0.1更改為 0.0.0.0/0,然後點選 [确定] 使白名單位址生效。
三、連接配接ECS伺服器
四、安裝LAMP環境
LAMP是指運作在Linux下的Apache、MySQL和PHP的環境。
1.安裝Apache服務及其擴充包。
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
2. PbootCMS是使用PHP語言開發的CMS系統。
執行以下指令,安裝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
4. 執行以下指令啟動MySQL資料庫。
systemctl start mysqld
五、搭建門戶網站
1.安裝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
六、向資料庫中導入CMS的初始資料
1.初始化資料庫pbootcms的表結構和資料。
sql_file="/var/www/html/static/backup/sql/"$(ls /var/www/html/static/backup/sql/) &&
mysql -hpc-uf6489kn437r57p59.mysql.polardb.rds.aliyuncs.com -utest_user -pPassword1213 -Dpbootcms < $sql_file
經過一番周折,終于可以了。
2.修改CMS系統資料庫配置。
cat > /var/www/html/config/database.php << EOF
<?php
return array(
'database' => array(
'type' => 'mysqli', // 資料庫連接配接驅動類型: mysqli,sqlite,pdo_mysql,pdo_sqlite
'host' => 'pc-uf6489kn437r57p59.mysql.polardb.rds.aliyuncs.com', // PolarDB資料庫連結位址
'user' => 'test_user', // PolarDB資料庫的使用者名
'passwd' => 'Password1213', // PolarDB資料庫的密碼
'port' => '3306', // 資料庫端口
'dbname' => 'pbootcms' //資料庫名稱
)
);
EOF
3.檢視安全組
本實驗使用的ECS預設是打開所有的端口,-1/-1 ,故不用單獨設定。
4.通路程式。
執行以下指令重新開機 Apache服務。
systemctl restart httpd
七、進入門戶網站首頁
通路:
http://139.224.165.163/如圖所示,通路成功。
/admin.php。預設賬号為admin,密碼為123456。
至此已完成門戶網站的搭建,如此就可以根據公司的需求自定義門戶網站的内容。