


Basic tutorial on configuring the forum program Discuz under Linux Nginx MySQL, _PHP tutorial
Basic tutorial on configuring the forum program Discuz under Linux Nginx MySQL,
Crossday Discuz! Board (Discuz! for short) is a set of general tools launched by Beijing Kangsheng Xinchuang Technology Co., Ltd. Community forum software system. Since its launch in June 2001, Discuz! has more than 14 years of application history and more than 2 million website user cases. It is one of the most mature and coverage forum software systems in the world. The latest version, Discuz! X3.2, was officially released on June 9, 2015, introducing the application center development model for the first time. On August 23, 2010, Kangsheng Chuangxiang reached an acquisition agreement with Tencent and became a wholly-owned subsidiary of Tencent.
Crossday Discuz! Board (hereinafter referred to as Discuz!, Copyright Registration No. 2006SR11895 of the National Copyright Administration of China) is a universal community forum software system launched by Comsenz (Beijing) Technology Co., Ltd. (Comsenz in English). Users can Based on any programming required, through simple settings and installation, a forum service with complete functions, strong load capacity and highly customizable can be built on the Internet. Discuz!'s infrastructure is implemented using PHP MySQL, the world's most popular web programming combination. It is an efficient forum system solution that is well designed and suitable for various server environments.
As the largest community software and service provider in China, the Discuz! development team under Comsenz has rich experience in web application design, especially in forum products and related fields. After long-term innovative development, it has mastered a complete set of algorithms and data structures. to leading technologies in product safety. This makes Discuz! in the leading position among similar products at home and abroad in terms of stability, load capacity, safety and other aspects.
Let’s take a look at the Discuz installation and configuration process in the LNMP environment:
1. Configure nginx
vim /usr/local/nginx/etc/nginx.conf
user nginx; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; error_log logs/error.log info; events { worker_connections 1024; } http { include mime.types; server_tokens off; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; keepalive_timeout 65; client_header_buffer_size 32k; large_client_header_buffers 4 32k; #客户请求头缓冲大小 nginx默认会用client_header_buffer_size这个buffer来读取header值,如果header过大,它会使用large_client_header_buffers来读取如果设置过小HTTP头/Cookie过大 会报400 错误 nginx 400 bad request求行如果超过buffer,就会报HTTP 414错误(URI Too Long)nginx接受最长的HTTP头部大小必须比其中一个buffer大,否则就会报400的HTTP错误(Bad Request)。 client_max_body_size 8m; #最大上传附件8MB client_body_buffer_size 128k; #缓冲区代理缓冲用户端请求的最大字节数 keepalive_timeout 60; tcp_nopush on; tcp_nodelay on; gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; include vh/bbs.yourich.com.cn.conf; } mkdir /usr/local/nginx/etc/vh vim /usr/local/nginx/etc/vh/discuz.conf upstream bbs.test.com { server 127.0.0.1; check interval=3000 rise=2 fall=5 timeout=1000 type=http; #interval检测间隔时间,单位为毫秒 #rsie请求2次正常的话,标记此realserver的状态为up #fall表示请求5次都失败的情况下,标记此realserver的状态为down #timeout为超时时间,单位为毫秒 check_http_send "GET / HTTP/1.1\r\nHOST:\r\n\r\n"; check_http_expect_alive http_2xx http_3xx http_4xx; } server { listen 80; server_name bbs.test.com; index index.html index.php; root /www/discuz; access_log logs/bbs_access.log main; error_log logs/bbs_error.log; location ~ .*\.(jpg|jpeg|png|gif\js|css)$ { root /www/discuz; access_log off; } location / { try_files $uri $uri/ /index.php?$args; } location ~.*\.(php)?$ { expires -1s; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; try_files $uri = 404; include fastcgi_params; fastcgi_param SCRIPT_FILENAME /www/discuz$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; } }
2. Download discuz
Download the discuz installation package and unzip it. Copy all the contents in the upload directory to the website document and directory specified by nginx /www/discuz
Set permissions
chown -R nginx:nginx /www/discuz
3. Create data
create database discuz default character set utf8; grant all privileges on discuz.* to discuz@'localhost' identified by 'discuz'; flush privileges;
4. Install discuz
Enter http://ip/install in the browser to install according to the wizard
Articles you may be interested in:
- Solution to the forgotten password of DISCUZ forum administrator
- DISCUZ forum UBB editor (added flexible calling, supports ASP UBB parsing) Package download
- DISCUZ paging code

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft