BT(宝塔) is a VPS control panel application, it can help you to operate and maintain VPS server and website, it is developed by china company. It is similar with CPanel and ISPConfig etc. But it is very easy to use than them. It is free. This article will tell you how to install it, and how to use it to transfer a WordPress website into it.
1. Install BT VPS Control Panel In Linux.
- First you should get a VPS server, or you can install it on your local machine.
- Install a linux os on the server, the most compatible linux version is CentOS7.
- SSH to the linux server in a terminal. Then run install script to install it. You can get detail install script and instruction in this page. Below is ubuntu install script. Others is similar.
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
- After you run the BT install script in ssh terminal, it will show you below information at the end.
================================================================== Congratulations! Installed successfully! ================================================================== Bt-Panel: http://18.104.22.168:8888/c1018989 username: ui89huhj password: i8fdsff8 Warning: If you cannot access the panel, release the following port (8888|888|80|443|20|21) in the security group ==================================================================
- The url is just the BT control panel url. It include a unique id at the end of the url. And it tell you to open some port number in your security group( if your vps server sit inside a firewall such as amazon aws’s security group, google’s firewall ). Because BT control panel will use these port number to process user request.
- 8888 port number is the BT panel default web admin port number, you should change it after your first login. To change this port number and username and password, you should login to the BT control panel, then click dashboard settings ( 面板设置 ) menu item in left side, then you can change them in right panel.
- 888 port number is used by phpMyAdmin( a MySql management tool ). To change phpMyAdmin port number, you can follow below picture.
- 80 port number is used by the website by default.
- 443 port number is used by https tls.
- 20 port number is used by FTP to transfer data.
- 21 port number is used by FTP to make connection.
2. Install Linux Software In BT Admin Web Panel.
- Login to the BT linux control panel with above url ( http://22.214.171.124:8888/c1018989 ) use username and password.
- If this is your first time login, it will popup a dialog to let you select one recommended application to install, i choose LNMP in left. You had better check the compile installation ( 编译安装 ) checkbox, then click the green button ( 一键安装 ). After that the selected Nginx, MySQL, FTP Server, PHP and phpMyAdmin software will be installed in the linux server automatically. You should select the software version carefully that can support your WordPress version.
- If you want to show the installed software in panel home page. You can click Software Shop ( 软件商店 ) menu in left panel, then it will list all the software that can be installed in right panel. Click the green installed ( 已安装 ) button in right panel top area, it will list all the software that has been installed.
- At the end of each installed software, there is a toggle button in column 首页显示, toggle this button will decide whether display this software in home page or not.
- You can also search and install other software which you need in this software shop.
3. Add Website.
- Click WebSite ( 网站 ) menu in left panel.
- Click Add WebSite ( 添加站点 ) button in right panel to add a new website.
- Input domain name, one domain one line. Select related PHP version. Do not create database. Then click 提交 button.
- Now you can see the newly added website in the website list page.
- Click the root folder ( 根目录 ) in the website line, it will open the website root folder.
- Download the WordPress backup file, then click 上传 button to upload the backup file to above website root folder.
- At the end of the WordPress backup file, click 解压 link to unzip it. You can refer article How To Restore WordPress Website From Backup to learn more about WordPress backup and how to transfer those backup files.
4. Create WebSite MySQL Database And Import Exist WordPress Database Data.
- After you unzip above WordPress backup file, you will find a .sql ( for example abc_xyz.sql ) file in the root folder.
- Open this .sql file, you will find the database name in the top text lines.
...... -- Database Name: abc_xyz ......
- Open file wp-config.php in above unzip root folder. You can find the database name, username and password in below source code.
// ** MySQL settings ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'abc_xyz' ); /** MySQL database username */ define( 'DB_USER', 'test' ); /** MySQL database password */ define( 'DB_PASSWORD', '12345678' );
- Click the 数据库 menu in left panel. Then click 添加数据库 green button in right database list panel.
- Input database name, username and password in the popup dialog. Click 提交 button to create it.
- After create the MySQL database, you can find the database in the database list page.
- Click the 导入 link in the 备份 column of one database line, then it will popup a dialog that let you upload your sql file. If your file is too big, you can upload the big sql file to server use FTP, you can see detail explanation in the popup dialog.
- After import the database, you can now manage the database.
5. Manage The MySQL Database Table Data.
5.1 Get MySql Database Root User Password.
- Check the checkbox at the beginning of the MySql database line, then click root密码 button at database list page top area, it will popup a dialog which contains the root user password, remember the password or you can change it to your own password.
- Now click 管理 link at the end of the database line, then it will popup phpMyAdmin login page in a new tab. If you do not installed phpMyAdmin, it will tell you to install it first. If you find phpMyAdmin page can not be opened, you should make sure port 888 has been allowed by your vps firewall.
5.2 Create Your WordPress User Account.
- Click User accounts tab at the top of phpMyAdmin admin web page. If you can not see User accounts tab, click the Server:localhost link at top left corner of phpMyAdmin admin web page. If you still can not find User accouts tab, then close the phpMyAdmin page, and reopen the phpMyAdmin page again, then you can find User accounts tab.
- You can find the WordPress used MySql database user account in the list. If you do not find it, you can click Add user account link at web page bottom left to add your user account.
- Edit the user account privileges, assign all privileges to the [email protected] and [email protected]
5.3 Verify WordPress WebSite Database Data.
- Click your WordPress website database name in phpMyAdmin left panel.
- Then it will list all database tables. Click the table with _options suffix. Then you can verify below two row data value, siteurl and home.
6. Set WebSite Pseudo Static For WordPress To Avoid 404 Error When Browse WordPress Article.
Now your WordPress website has been setup and restored use BT(宝塔) linux control panel. But if you browse you post, you will get 404 error. But the website home page and admin page can be accessed. This is because you do not set the Pseudo Static for your WordPress. Below is the steps about how to set it.
- Click 网站 menu in left panel to go to web site list page.
- Click website name, then click Pseudo Static ( 伪静态 ) menu item in left panel, the select wordpress in right panel drop down list, then click save ( 保存 ) button.
- Now you can access your website article correctly. If the article page still return 404, you can login to WordPress admin site, then click Save Changes button in Settings —> Permalinks page.
7. Enable SSL To The WordPress Website.
Now your WordPress website is ready for user to access, but it is not a secure website. To make it secure we should enable SSL to it follow below steps.
- Go to the website list page, click the website domain name to open website edit popup dialog.
- Click SSL menu in left panel. Click the Let’s Encrypt tab, check all domain checkbox, click apply ( 申请 ) button.
- After apply the SSL encrypt, turn on the 强制HTTPS toggle radio button at top right. Now your WordPress website has been changed to a secure website.
8. How To Add CloudFlare To Your Website.
If you want to use CloudFlare as your website CDN. You can read article CloudFlare Plus SSL To Make Your WordPress Fast And Secure.
9. How To Change BT(宝塔) Panel Port Number And phpMyAdmin Port Number.
The default BT panel port number is 8888, and the default phpMyAdmin port number is 888. For security reason, you should change it at once after you install it. Below is the steps. After you change the port number, you should make sure to add the new port number in the firewall to allow them being accessed.
9.1 Change BT(宝塔) Panel Port Number.
- Login to BT panel.
- Click Dashboard Settings ( 面板设置 ) in left side panel, then you can change the panel port number, username and password in right panel. You can see them in below picture red circle.
9.2 Change phpMyAdmin Port Number.
- Login to BT panel.
- Click software shop ( 软件商店 ) in left panel.
- You can see phpMyAdmin in right installed software list. Click 设置 link at the end of phpMyAdmin line.
- Then it will popup a dialog. Click 安全设置 tab in left, then you can change 访问端口 value.
- You should also click the php版本 tab in left to check whether the php version is correct or not. This may cause the phpMyAdmin unreachable.
10. Why Can Not Access BT Panel And PhpMyAdmin.
- BT panel and phpMyAdmin port number is not added in firewall rule.
- Do not set phpMyAdmin php version correctly.
- Do not install phpMyAdmin.