This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9400|Reply: 9

Deploy the Discuz forum using Docker installation

[Copy link]
Posted on 2021-11-28 19:21:35 | | | |
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 Docker containers on CentOS 7
https://www.itsvse.com/thread-9999-1-1.html

Docker package conflict issue when installing CentOS 8
https://www.itsvse.com/thread-10115-1-1.html
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 timeYou 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:

Install the GD extension based on the Docker php:5.6.40-fpm image
https://www.itsvse.com/thread-10175-1-1.html

Install the Redis extension based on Docker php:5.6.40-fpm image
https://www.itsvse.com/thread-10176-1-1.html
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:

[Practice] Check php-fpm status information through Nginx
https://www.itsvse.com/thread-10180-1-1.html

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:

Install nginx service with CentOS source code
https://www.itsvse.com/thread-10058-1-1.html
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, pleaseReply


(End)





Previous:[Practice] Check php-fpm status information through Nginx
Next:Spring Boot obtains all users of the AD domain (LDAP).
 Landlord| Posted on 2021-11-29 17:58:10 |
Close the php X-Powered-By message
https://www.itsvse.com/thread-2092-1-1.html
 Landlord| Posted on 2021-12-3 13:27:16 |
Resolve 413 Request Entity Too Large



The default request body in Nginx is 1M, edit the nginx.conf configuration file, and add the following configuration to http{}:



 Landlord| Posted on 2022-11-13 14:39:13 |
phpmyadmin You can specify the MySQL host in the PMA_host environment variables. You can also use PMA_PORT the port of the specified server in case it is not the default port:


Host 'xxx' is not allowed to connect to this MySQL server
https://www.itsvse.com/thread-7735-1-1.html
Posted on 2023-5-31 16:51:50 |
Reason for studying this article: Require intranet machine docker deployment forum. Need to look at the command line.
Also: Thanks to the author for posting.
Posted on 2023-6-14 16:25:45 |
Why can't I enter the corresponding page when I use my IP and add the port number to report the error of 502?
This is my first time using docker, so I'm not very familiar with it. Please, thank you.
Posted on 2023-6-16 13:26:28 |
Almarc Posted on 2023-6-14 16:25
Why can't I enter the corresponding page when I use my IP and add the port number to report the error of 502?
This is my first time using docker, so I'm not very familiar with it. Please, thank you. ...

The problem is queried that it is necessary to use tools to access MySQL, I thought it was direct web browsing.
In addition, there is an error reported when installing php-rpm, as shown in the figure below, please ask the altar master how to solve it:
ERROR: failed to open configuration file '/usr/local/etc/php-fpm.conf': No such file or directory (2)
ERROR: failed to load configuration file '/usr/local/etc/php-fpm.conf'
ERROR: FPM initialization failed
Thank you
Posted on 2024-3-26 17:20:18 |
The tutorial is good
 Landlord| Posted on 2024-3-27 08:27:39 |
Debian repository update prompts with a 404 error
https://www.itsvse.com/thread-10698-1-1.html
 Landlord| Posted on 2025-9-20 21:08:42 |
php-fpm to close the request log output, edit: /php-fpm.d/www.conf
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com