Nginx common modules and functions

 

 

Detailed Nginx module

nginx module is divided into two types, an official and a third party , we see the nginx nginx -V command module has been installed!

[root@localhost ~]# nginx -V

nginx version: nginx/1.15.9
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
configure arguments: --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module
 
 
# Enabled ngx_http_addition_module support, as an output filter, the buffer is not completely supported, in portions in response to the request
 --with-http_addition_module 

--with-http_auth_request_module 
 
# enabled ngx_http_dav_module support (increased PUT, DELETE, MKCOL: creating a collection, COPY and MOVE methods) By default it is turned off, turned on the need to compile --with-http_dav_module 
# enable ngx_http_flv_module support (seeking to provide memory-based file offset time) --with-http_flv_module 
--with-http_gunzip_module 
# enable ngx_http_gzip_static_module support (online real-time compression output data stream) --with-http_gzip_static_module 
--with-http_mp4_module 
# enabled ngx_http_random_index_module support (randomly selected from a directory index directory) --with-http_random_index_module 
# ngx_http_realip_module support enabled, this module allows the client to change the IP address from the request header value the default is off --with-http_realip_module 
# enable ngx_http_secure_link_module support (computing and inspection requirements needed to secure the link URL)
 


 


 

 

 

http_secure_link_module---with 

--with-http_slice_module
 
# Enable ngx_http_ssl_module support, only support https requests, the need to have installed OpenSSL --with-http_ssl_module 
# Enable ngx_http_stub_status_module support (get working condition since the nginx since the last start) --with-http_stub_status_modul E 
# enable ngx_http_sub_module support (allows text to replace some other text nginx response) --with-http_sub_module 
--with-http_v2_module 
# enable ngx_mail_ssl_module support --with-mail_ssl_module
 




  

 

1.  --with-http_stub_status_module
This module shows the current client state of nginx
Configuration syntax: stub_status;
Default: no configuration
Arrangement positions: server, location below

 

Then restart nginx

 

 

Where: Active connections: represents the number of active connections currently nginx
     server accepts handled requests: There are three values, a first value indicates the number of nginx handshake process, a second value represents the number of connections nginx process, the third value represents the total number of requests, and normal times for the number of connection handshake value should be equal, meaning no loss of connection

 

.  --with-http_random_index_module
Select a directory index from the specified directory random, usually with more than Home diversification, giving the home feeling constantly changing.
Configuration syntax: random_index on | off;
Default value: off
Arrangement positions: location at
Case are as follows:
Create a directory / opt created before now 2.1 / app / next directory code, written in html inside three, three html inside as long as you can set the background color, as follows
 
Default.conf 2.2 configuration file, modify the following two places
2.3 Test
Reload nginx service, use the command service nginx reload;
Enter in your browser ip, you can see the page appear different background color, refresh a few times, to see the results, note that in the random directory configuration, if you write a hidden file, such as .4.html file, such hidden files will not be random to, you are interested, you can test.
3.  --with-http_sub_module
Alternatively response content server, such as the browser sends a request to the server, the server returns a Response, this can be replaced by the module configuration to be returned.
 
Configuration: There are several
The first:
Configuration syntax: sub_filter string (text to replace it) string (text to be used)
Default Configuration: no configuration
Configuration Location: http, server, location under
 
The first actual configuration demo
3.1 sub_filter.html a new file in the code directory, as follows
3.2 default.conf modify files, modify the root directory
3.3 reload the server, enter the URL access
3.4 Now I want to configure sub_module module, so that the contents of the returned change
Default.conf again modified file, and configure the text after the text to be replaced at the replacement LOCATION, as follows
重新加载后,再次输入网址,发现内容已经被替换

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 



Guess you like

Origin www.cnblogs.com/cxm123123form/p/11599753.html