nginx优化项目
隐藏版本信息 server_tokens
Syntax: server_tokens on | off | build | string;
Default: server_tokens on;
Context: http, server, location
设置cpu棵树
Syntax: worker_processes number | auto;
Default: worker_processes 1;
Context: main
cpu优化
worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;
work最大连接数
Syntax: worker_connections number;
Default: worker_connections 512;
Context: events
打开文件数
Syntax: worker_rlimit_nofile number;
Default: —
Context: main
开启高校传输------->零拷贝
Syntax: sendfile on | off;
Default: sendfile off;
Context: http, server, location, if in location
讲数据信息进行快速传输
Syntax: tcp_nodelay on | off;
Default: tcp_nodelay on;
Context: stream, server
This directive appeared in version 1.9.4.
将数据积攒传输
Syntax: tcp_nopush on | off;
Default: tcp_nopush off;
Context: http, server, location
优化客户端访问nginx服务器超时时间
Syntax: keepalive_timeout timeout [header_timeout];
Default: keepalive_timeout 75s;
Context: http, server, location
优化服务器短请求超时时间
Syntax: client_header_timeout time;
Default: client_header_timeout 60s;
Context: http, server
优化两个请求主体发送间隔超时时间
Syntax: client_max_body_size size;
Default: client_max_body_size 1m;
Context: http, server, location
优化两个响应信息的间隔时间
Syntax: send_timeout time;
Default: send_timeout 60s;
Context: http, server, location
设置客户端请求报文主题最大尺寸
Syntax: client_max_body_size size;
Default: client_max_body_size 1m;
Context: http, server, location
设置使用类型
Syntax: user user [group];
Default: user nobody nobody;
Context: main