nginx调优简介

(1)开启status模块

location /status {
	stub_status on;#开启status模块
	access_log off;#关闭访问日志记录
	allow 127.0.0.1;#允许IP访问
	allow localhost;
	deny all;#拒绝其他IP访问
}

(2)设置并发

worker_processes  2;#启动多少个worker进程
events {
    worker_connections  50000;#每个worker进程支持的最大并发连接数量
}

(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;#最大缓存数量,清除指定时间内无请求的缓存
op
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值