• nginx调优配置

user www www;

#工作进程:数目。根据硬件调整,通常等于CPU数量或者2倍于CPU。

worker_processes 8;

worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;

#错误日志文件及其级别;出于调试的目的,可以使用debug级别,但此级别只有在编译nginx时使用了--with-debug选项才有效;

#debug | info | notice | warn | error | crit | alert | emerg error_log /opt/nginx/logs/nginx_error.log crit;

pid /opt/nginx/logs/nginx.pid; worker_rlimit_nofile 65535;

events {

use epoll;

#每个进程允许的最多连接数, 理论上每台nginx 服务器的最大连接数为worker_processes*worker_connections。

worker_connections 6000;

}

http {

include mime.types;

default_type application/octet-stream;

server_names_hash_bucket_size 3526;

server_names_hash_max_size 4096;

log_format main '$remote_addr - $remote_user [$time_local] "$request"'

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" $http_x_forwarded_for';

access_log    /opt/nginx/logs/access.log main;

sendfile on;

tcp_nopush on;

#常连接配置

keepalive_timeout 60;

keepalive_requests 200;

#读取http请求报文

client_header_timeout 120;

client_body_timeout 120;

#客户端请求头部的缓冲区大小,这个可以根据你的系统分页大小来设置,一般一个请求头的大小不会超过1k,不过由于一般系统分页都要大于1k,所以这里设置为分页大小。分页大小可以用命令getconf PAGESIZE 取得。

client_header_buffer_size 4k;

large_client_header_buffers 8 4k;

#响应报文

send_timeout 120;

#压缩配置

gzip on;

gzip_min_length 1k;

gzip_buffers 4 8k;

gzip_comp_level 5;

gzip_http_version 1.1;

gzip_types text/plain application/x-javascript text/css text/htm application/xml;

open_file_cache max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;

#此server配置 ip访问403,本机查看ngx_status

server{

     listen *:80 default_server;
          server_name _;
          #return 403;
          root /tmp;
          location /ngx_status{
              stub_status on;
              access_log off;
              allow 127.0.0.1;
              deny all;
         }

}

include /opt/nginx/conf/vhosts/*.conf;

}

最新文章

  1. dict与list的in 操作的速度
  2. jcmd、jmc介绍
  3. House Robber III leetcode 动态规划
  4. 开始VS 2012中LightSwitch系列的第4部分:太多信息了!使用查询来排序和筛选数据
  5. asp.net首页设置
  6. centos7 修改selinux 开机导致 faild to load SELinux policy freezing 错误
  7. C++:类的成员函数定义方式
  8. HDU 4336-Card Collector(状压,概率dp)
  9. HttpClient(4.3.5) - HTTP Header
  10. 转 jQuery(图片、相册)插件代码实例
  11. CI Weekly #20 | 从持续集成的角度看 “云” 的价值
  12. Hybrid APP 架构设计思路
  13. Deploy Mysql
  14. jQuery 遍历 – 过滤
  15. MinHash 原理
  16. SpringBoot2.X + SpringCache + redis解决乱码问题
  17. PythonStudy——文件操作 File operation
  18. Python学习——深浅拷贝
  19. python学习之老男孩python全栈第九期_day007作业
  20. Django ORM之QuerySet

热门文章

  1. HTTP返回码中200,302,304,404,500得意思
  2. (转)教你分分钟搞定Docker私有仓库Registry
  3. error C2065: “SHELLEXECUTEINFO”: 未声明的标识符
  4. 测开之路四十九:用Django实现扑克牌游戏
  5. BootStrap的一些基本语法
  6. selenium,webdriver爬取斗鱼主播信息 实操
  7. C++中函数调用操作符的重载
  8. python文件的读写总结
  9. hdu 5435 A serious math problem
  10. Python之随机选择 random