2 - 4 - 운영 필수 핵심 기능 - nginx 웹 서비스 설정 실현
12、keepalive_timeout timeout [header_timeout]
,0 , 75s
13、keepalive_requests number
, 100, 12 0,
14、keepalive_disable none | browser ...
, , ( )
15、send_timeout time--- , ,
, ,
resolver_timeout---
16、client_body_buffer_size size--- nginx post , body, ( , )
body ; 16k; , client_body_temp_path ( IO, )
17、client_body_temp_path path [level1 [level2 [level3]]]
body --- url hash , hash hash (1 2 ) , ,
16
client_body_temp_path /var/tmp/client_body 2 1 1
1: 16 :0-f
2: 2 16 :00-ff
2: 2 16 :00-ff
echo http://www.ilinux.io/index.html | md5sum 1182a。。。。。。hash
:
18、limit_rate rate
, bytes/second,0
,
19、limit_except method ... {...}--- get head post ,
limit_except GET {--- get , ,
allow 192.168.1.0/24;
deny all;
}
20、aio on | off |threads[=pool];--- , on
aio ;
21、directio size | off;--- , ,
linux O_DIRECT , , directio 4m;
22、open_file_cache off;--- LRU,
open_file_cache max=N [inactive=time];
nginx :---
(1) ,
(2)
(3)
max=N: ; LRU ( ) --- , ,
inactive=time: , open_file_cache_min_uses
23、open_file_cache_valid time;
; 60s
24、open_file_cache_min_uses number;
open_file_cache inactive ,
25、open_file_cache_errors on | off
;
ngx_http_access_module :
IP
26、allow address | CIDR |unix: | all;
27、deny address | CIDR |unix: | all;
ngx_http_auth_basic_module
, basic ;
28、auth_basic string | off
29、auth_basic_user_file file;
location /admin/ {
alias /webapps/app1/data/;
auth_basic "Admin Area";
auth_basic_user_file /etc/nginx/.ngxpasswd;
}
:htpasswd httpd-tools ;yum install -y httpd-tools
htpasswd -c -m /etc/nginx/.ngxpasswd tom--- , tom
:
location ~* ^/(admin|login) {--- admin login
auth_basic "admin area or login url";
auth_basic_user_file /etc/nginx/.ngxpasswd;---
}
mkdir /data/nginx/vhost1/admin
vim /data/nginx/vhost1/admin/index.html
, , admin area or login url32:00
ngx_http_stub_status_module ---nginx
nginx ;
Active connections:291
server accepts handled requests
16630948 16630948 31070465
Reading:6 Writing:179 Waiting:106
Active connections: ;
accepts:
handled: ;
requests: ;
Reading:
Writing: ;
Waiting: 、 ;
30、stub_status:--- , , , auth-basic
:
location /basic_status {
stub_status;
}
ngx_http_log_module
he ngx_http_log_module module writes request logs in the specified format.
31、log_format name string ...;
string nginx ;
: nginx httpd combined ;
32、access_log path [format[buffer=size][gzip[=level]][flush=time][if=condition]];--- http
access_log off;--- ,
, ;
buffer=size--- , ,
flush=time
gzip: , cpu ,
33、open_log_file_cache max=N[inactive=time][min_uses=N][valid=time];
open_log_file_cache off;--- LRU
: ,
;
max: ;
min_uses: inactive ;
inactive:
valid: ;
ngx_http_gzip_module:--- cpu ,
The nbx_http_gzip_module module is a filter that compresses responses using the "gzip" method.This often helps to reduce the size of transmitted data by half or even more.
1、gzip on | off;
Enables or disables gzipping of responses.
2、gzip_comp_level level;--- 1
Sets a gzip compression level of a response.Acceptable values are in the range from 1 to 9.
3、gzip_ddisable regex ...;---
Disables gzipping of responses for requests with "User-Agent" header fields matching any of the specified regular expressions.
4、gzip_min_length length;--- 20
;
5、gzip_buffers number size;
gzip_buffer 32 4k | 16 8k;
; ,
6、gzip_proxied off | expired | no-cache | no-store | private | no_last_modified | no_etag | auth | any ...;
nginx , ;
off:
no-cache,no-store,private: Cache-Control , ;
7、gzip_types mime-type ...;
, MIME ;
:
gzip on;
gzip_proxy any;
gzip_types text/xml text/css application/javascript;
8、gzip_vary on | off;
gzip, Vary:Accept-Encoding
: gzip on,gzip_comp_level,gzip_types , gzip_proxied
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
셸 입문 부터 정통 한 for 순환 및 6 가지 난수 생 성 법순환 용 1. [문법 구조] 2. 문법 linux 에서 무 작위 수 를 만 드 는 여섯 가지 방법 방법 1: 방법 2: openssl 을 통 해 난수 생 성 방법 3: date 시간 을 통 해 얻 을 수 있 습 니 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.