Home > Backend Development > PHP Tutorial > Brief description of basic configuration of Nginx server

Brief description of basic configuration of Nginx server

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 08:57:23
Original
1186 people have browsed it

This article briefly introduces the basic contents of Nginx configuration file.

1.Nginx’s default configuration file

The default main configuration of Nginx is located in the conf folder of the installation directory, nginx.conf and nginx.conf.default. [Note: If they have not been changed, the contents of the two files here are the same. The function of nginx.conf.default is to facilitate users to restore the default configuration] Other files in the conf folder are used to configure different modules of Nginx.

2.nginx.conf file brief description

Nginx’s main configuration file is divided into several blocks, global block, events block, server block, and location block.

2.1 Global block

The part between the beginning of the nginx.conf file and the events block is a global block, which affects the entire Nginx world, including users (groups), the number of worker processes allowed to be generated, the log storage directory, and the directory of the pid file. . As shown below:
Brief description of basic configuration of Nginx server

2.2 events block

The events block has a clear structure and is marked with two curly brackets. The events block mainly involves the network connection between the Nginx server and the user.

<code><span>events</span><span>{
    worker_connections    <span>1024</span>;
}</span></code>
Copy after login

The default configured events block only configures the maximum number of connections allowed per worker process.

2.3 http block

The http block contains global blocks (http global blocks) that act within the http scope, as well as server blocks and location blocks.
Brief description of basic configuration of Nginx server
In the http block structure shown in the figure above, the part of the configuration block from the beginning to the server block is the http global block. You can see that in the http global block, you can include mime.types, log customization, whether to use sendfile to transfer files, connection timeout and whether to use the gzip module, etc.

2.3.1 server block

Through the settings of the server block, the Nginx server can be made to serve several websites.
Brief description of basic configuration of Nginx server
As shown in the figure above, multiple such server blocks can be configured in the http block to serve multiple websites respectively.

2.3.2 Location block

Each server block can contain multiple location blocks. Match the requests received by the Nginx server and process special requests. Location specific items, data caching and permission control can all be configured in the location block.

Reference:
1. "Detailed Explanation of Nginx High-Performance Web Server" edited by Miao Ze, Beijing: Electronic Industry Press, 2013.10

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above is a brief introduction to the basic configuration of the Nginx server, including all aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Error restarting nginx
From 1970-01-01 08:00:00
0
0
0
server - Nginx configuration webapp problem
From 1970-01-01 08:00:00
0
0
0
Nginx default.conf problem
From 1970-01-01 08:00:00
0
0
0
centos7 - NGINX exception occurs
From 1970-01-01 08:00:00
0
0
0
nginx load balancing
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template