Prepare to migrate the forum to a Docker environment application, to facilitate the subsequent migration, simply enter a few commands to migrate the previous forum data to the new server. This article uses Docker to build a new Discuz forum to test the waters.
For the tutorial on installing Docker in a Linux environment, please refer to the following:
Install the MySQL app
Install MySQL Database version 5.7.34 with the following command:
After the execution is completed, you can access the host machine's IP:3306 port, and the account and password are both :root
Install the phpMyAdmin app
phpMyAdmin is a free software tool written in PHP designed to handle the administration of MySQL over the web. phpMyAdmin supports a wide range of operations with MySQL and MariaDB. Frequently used operations (managing databases, tables, columns, relationships, indexes, users, permissions, etc.) can be performed through the user interface, while you can still execute any SQL statement directly.
The command is as follows:
After the execution is completed, you can access the host's IP:8081 through a browser and enter the MySQL account and password, as shown in the figure below:
Install the Redis app
Because Discuz can set some content to cache to redis, thereby improving access speed and performance, it is very useful for webmasters who need it, install the redis app with the following command:
Install the FTP service
Discuz can upload attachments to remote servers through FTP protocol, forum attachments (images) can be accessed through second-level domain names, and second-level domain names can be accelerated by CDN to improve the loading speed of websites.
Create a new /data/wwwroot/ftp_data directory to store the attachment contents, and use the following command:
The command to install the FTP service using Docker is as follows:
The FTP account and password are: dz_itsvse/a123456
Note: Be sure to set the LOCAL_UMASK parameter, otherwisenginx will report a 403 error without permission when accessing!
Upload the Discuz program to the host machine
Create a new /data/wwwroot/discuz directory and save it to the site program, with the following command:
After uploading, as shown below:
Install the php-fpm app
Create a new php configuration folder on the host machine, and the command is as follows:
For the first time(You can just use the attachment of my post, you don't need to do this!You need to start a php-fpm container and use the docker cp command to copy the configuration to the host's mapping directory with the following command:
Start a php-fpm app using docker
After starting the container, you need to go inside the container to install some php extensions, such as: GD, mysql, redis, etc., otherwise, you will not be able to connect to the database, use the redis cache, process images, etc.
Use the following command to enter the container:
Enter the container and execute the following command:
For information on installing GD and Redis extensions, please refer to the following articles:
After installing the extension, you need to restart the php5-fpm container for it to take effect!
Go inside the php5-fpm container again,Modify the attributable users and groups in the /data/wwwroot/discuz directory, otherwise it will not be read and executed with php-fpm! The page will go blank! The command is as follows:
In the /data/wwwroot/discuz directory, create a new phpinfo.php file with the following command:
php.ini The most important optimization settings are as follows:
php-fpm container by defaultTuning php-fpmparameters, as well as the configuration to set the php.ini (time zone, maximum file upload limit, etc.), can be referred to:
Nginx reverse proxy php-fpm
I installed the nginx service directly on the host machine, and I didn't install it using docker, you can refer to the installation as follows:
The main configuration of nginx.conf is as follows:
Browser access test:http://dev.itsvse.com:8099/phpinfo.php, as shown in the figure below:
Start installing Discuz
The above are all preparations, prepare mysql, ftp, redis, nginx, php-fpm, etc., and then start the real installation, access:http://dev.itsvse.com:8099/, as shown in the figure below:
Set up a MySQL database connection as shown in the following figure:
The installation is complete, as shown below:
Set up the remote attachment for testing, as shown below:
Test whether the watermark on the image is normal, as shown below:
Modify the /data/wwwroot/discuz/config/config_global.php setting to use Redis cache and configure it as follows:
Log in to the Redis container and see if the data is cached, as shown in the following image:
Post to test whether the remote attachment function is working properly, as shown in the figure below:
phpconfig.zip The file is as follows:
Tourists, if you want to see the hidden content of this post, please Reply
(End)
|