Home >Backend Development >PHP Tutorial >Parse Nginx configuration file
2. HTTP server configuration
Next, start the HTTP server settings.
The following content is Nginx’s configuration of HTTP server-related attributes. The code is as follows:
[html] view plaincopy
[html] view
plaincopy
MLog_Format Main' $ Remote_ADDR-$ Remote_user [$ Time_local] '
3.HttpGzip module configuration
Configure Nginx’s HttpGzip module below. This module supports online real-time compression of output data streams. To check whether this module is installed, you need to use the following command:
[html] view plaincopy
[html] view plaincopy
4. Load balancing configuration
Set the load balancing server list below.
[html] view plaincopy
5.server virtual host configuration
The following introduces the configuration of the virtual host. It is recommended to write the configuration content of the virtual host into another file and then include it through the include directive, which makes maintenance and management easier.
[html] view plaincopy
6.URL matching configuration
URL address matching is the most flexible part of Nginx configuration. Location supports regular expression matching and conditional judgment matching. Users can use the location directive to implement Nginx filtering of dynamic and static web pages.
The following setting uses the location directive to analyze and process the web page URL. All static files with extensions ending in .gif, .jpg, .jpeg, .png, .bmp, and .swf are handed over to nginx for processing, and expires Used to specify the expiration time of static files, here it is 30 days.
[html] view plaincopy
After entering the password, the system will ask you to enter the password again. After confirmation, the user is added successfully.
To check the running status of Nginx, you can enter http://ip/ NginxStatus, then enter the username and password you just created to see the following information:
Active connections: 1
server accepts handled requests
Reading: 0 Writing: 1 Waiting: 0
Active connections indicates the number of currently active connections. The three numbers in the third line indicate that Nginx has currently processed a total of 393411 connections, successfully created 393411 handshakes, and processed a total of 393799 requests. . Reading in the last line indicates the number of client header information read by Nginx. Writing indicates the number of header information returned to the client by Nginx. "Waiting" indicates the number of resident connections that Nginx has completed processing and is waiting for the next request instruction.
[html] view
plaincopy
404.html;
location