BT(宝塔) is a VPS control panel application, it can help you to operate and maintain a VPS server and website, it is developed by china company. It is similar to 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 the install script to install it. You can get a detailed install script and instructions on this page. Below is the ubuntu install script. Others are 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 the below information at the end.
================================================================== Congratulations! Installed successfully! ================================================================== Bt-Panel: http://126.96.36.199: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 admin control panel URL. It includes a unique id at the end of the URL. And it tells you to open some port number in your security group( if your VPS server sits inside a firewall such as an amazon AWS’s security group, google’s firewall ). Because the BT admin control panel will use these port numbers to process the user requests.
- 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 log in to the BT control panel, then click dashboard settings ( 面板设置 ) menu item on the left side, then you can change them on the right panel(面板端口).
- 888 port number is used by phpMyAdmin( a MySQL management tool ). To change phpMyAdmin port number, you should first click the 软件商店 menu item on the BT admin panel left navigator pane, then click the phpMyAdmin link in the software list, then it will popup the phpmyadmin管理 window, click the 安全设置 menu item on the left side of the popup window, then you can change the 访问端口 on the right side.
- 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 connections.
2. Install Linux Software In BT Admin Web Panel.
- Login to the BT Linux control panel with the above URL ( such as http://188.8.131.52:8888/c1018989 ) use the 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 on 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 and all the used plugins version ( You had better do not select the newest software version, because the newest version is not stable and not be used by so many websites, so I select MySQL 5.7, and PHP 7.4 and phpMyAdmin 4.7 ).
- If you want to show the installed software on the panel home page. You can click Software Shop ( 软件商店 ) menu in the left panel, then it will list all the software that can be installed in the right panel. Click the green installed ( 已安装 ) button in the 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 on the home page or not.
- You can also search and install other software which you need in this software shop.
3. Add Website.
- Click the WebSite ( 网站 ) menu in the left panel.
- Click Add WebSite ( 添加站点 ) button in the right panel to add a new website.
- You can input multiple domain names, one domain one line ( please note domain1.com and www.domain1.com are different domain names, you should add them all to make both domain names can reach your website ). You should select a related PHP version. Do not create the database. Then click the 提交 button.
- Now you can see the newly added website on 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 the above website root folder.
- At the end of the WordPress backup file, click the 解压 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 the 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 the 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 the left panel. Then click the 添加数据库 green button in the right database list panel.
- Input database name, username, and password in the popup dialog. Click the 提交 button to create it.
- After creating the MySQL database, you can find the database on 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 SQL file is too big, you can upload the big SQL file to the server use FTP, you can see a detailed 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 the database list page top area, it will pop up a dialog that 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. Log in to phpMyAdmin with root user and password, otherwise, you can not find the User accounts tab in phpMyadmin. If you have not installed phpMyAdmin, it will tell you to install it first. If you find the 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 the User accounts tab at the top of the phpMyAdmin admin web page. If you can not see the User accounts tab, click the Server:localhost link at the top left corner of the phpMyAdmin admin web page. If you still can not find the User accouts tab, first you should make sure you login with a root user account, or you can close the phpMyAdmin page, and reopen the phpMyAdmin page again, then you can find the 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 on the web page bottom left to add your user account.
- Edit the user account privileges, assign all privileges ( except ) to [email protected] and [email protected].
5.3 Verify WordPress WebSite Database Data.
- Click your WordPress website database name in the phpMyAdmin left panel.
- Then it will list all database tables. Click the table with _options suffix. Then you can verify below two row’s data values siteurl, and home.
6. Set WebSite Pseudo-Static For WordPress To Avoid 404 Error When Browse WordPress Article.
Now your WordPress website has been set up and restored use BT(宝塔) Linux control panel. But if you browse your post, you will get a 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 are the steps about how to set it.
- Click the 网站 menu in the left panel to go to web site list page.
- Click website name on the website list to popup the 站点修改 window, then click Pseudo-Static ( 伪静态 ) menu item in the popup window left panel, then 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 returns 404, you can log in to the WordPress admin site, then click the Save Changes button in Settings —> Permalinks page.
7. Enable SSL To The WordPress Website.
Now your WordPress website is ready for users to access, but it is not a secure website. To make it secure we should enable SSL to it follow the below steps.
- Go to the website list page, click the website domain name to open the website edit popup dialog.
- Click the SSL menu in the left panel. Click the Let’s Encrypt tab, check all domains’ checkboxes, click apply ( 申请 ) button.
- After applying the SSL encrypt, turn on the 强制HTTPS toggle radio button at the web page top right corner. 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 the article CloudFlare Plus SSL To Make Your WordPress Fast And Secure.
- When you add Cloudflare in front of your website, you can not use the website domain name to access it’s BT panel, because Cloudflare does not open the special port number which is used by your BT panel. You can access your website BT panel use it’s original IP address with the BT panel port number.
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 reasons, you should change it at once after you install it. Below are the steps. After you change the port number, you should make sure to add the new port number in the firewall to allow them to be accessed.
9.1 Change BT(宝塔) Panel Port Number.
- Log in to the BT panel.
- Click Dashboard Settings ( 面板设置 ) in the left side panel, then you can change the panel port number, username, and password in the right panel.
9.2 Change phpMyAdmin Port Number.
- Log in to the BT panel.
- Click software shop ( 软件商店 ) in the left panel.
- You can see phpMyAdmin in the right installed software list. Click 设置 link at the end of the phpMyAdmin line.
- Then it will pop up a dialog. Click 安全设置 tab in left, then you can change 访问端口 value.
- You should also click the php版本 tab on 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 are not added in the firewall rule.
- Do not set the phpMyAdmin PHP version correctly.
- Do not install phpMyAdmin.