记线上Ngnix 配置文件的优化项(部分)
写在开头
开始接手nginx以来一直就想着要整理一份日常在线上的一些优化配置项,不然每次调优的时候都要翻阅官网,麻烦得很!于是这篇东西就顺利产生了,毕竟线上的nginx使用还是很受到市场的欢迎的嘛!
worker_processes 8; //根据实际的cpu核数决定
worker_rlimit_nofile 100000;
events {
worker_connections 65535; 工作的进程连接数量
multi_accept on;
}
http {
安全和页面的优化
server_tokens off; //隐藏nginx的具体版本
sendfile on;
tcp_nopush on; //开启nginx使用TCP_NODELAY选项的功能
tcp_nodelay on; //Nagle和DelayedAcknowledgment的延迟
default_type text/html; //默认的种类
charset UTF-8; //使用万国编码
日志类的优化
access_log off; //关闭连接成功的日志记录
error_log error.log crit; // 错误日志
各种超时
keepalive_timeout 10; //连接超时时长
reset_timedout_connecfastcgi_connect_timeout 5;
fastcgi_send_timeout 10; //Fastcfgi发送超时
fastcgi_read_