: This article describes the basic configuration of the Nginx server. if you are interested in the PHP Tutorial, refer to it.
This article briefly introduces the basic content of the Nginx configuration file.
1. Nginx 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 the content of the two files is the same, nginx. conf. default is used to facilitate the user to restore the default configuration. other files in the conf folder are used to configure different Nginx modules.
2. nginx. conf file description
The main configuration file of Nginx is divided into several parts: global, events, server, and location.
2.1 Global block
Nginx. the part starting from the conf file to the events block is a global block that acts on the Nginx Global, including the user (group), the number of worker processes allowed to be generated, the log storage directory, and the pid file directory. For example:
2.2 events block
The events block structure is clear and marked with two braces. The events block mainly involves the network connection between the Nginx server and the user.
events{ worker_connections 1024;}
By default, only the maximum number of links allowed by each worker is configured.
2.3 http block
The http block contains the global block acting on the http range, and the server block and location block.
The http block structure shown in. the configuration block from the beginning to the server block is the http global block. You can see that the http global block can contain mime. types, custom logs, whether to use sendfile to transfer files, connection timeout, and whether to use the gzip module.
2.3.1 server block
Through server block settings, the Nginx server can serve several websites.
As shown in, this server block can be configured in multiple http blocks to serve multiple websites respectively.
2.3.2 location block
Each server block can contain multiple location blocks. The Nginx server can match the received requests and process special requests. You can configure the specified item, data cache, and promised control in the location block.
References:
1. edited by Miao Ze, Nginx high-performance Web server, Beijing: Electronics industry press, 2013.10
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above section briefly introduces the basic configuration of the Nginx server, including some content. if you are interested in the PHP Tutorial, please help.