nginx调优简介

(1)开启status模块

location /status {
	stub_status on;
}

(2)设置并发

worker_processes  2;
events {
    worker_connections  50000;
}

(3)设置最大可打开文件数

worker_rlimit_nofile 65535;

另外,注意linux系统最大文件限制数

vim /etc/security/limits.conf
root hard nofile 65000
root soft nofile 65000

(4)gzip压缩

gzip  on;
gzip_min_length 1000;
gzip_comp_level   4;
gzip_types   text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

(5)设置缓存

open_file_cache    max=2000  inactive=20s;
open_file_cache_valid   60s;
open_file_cache_min_uses   5;
open_file_cache_errors    off;

你可能感兴趣的:(其他,nginx)