全球主机交流论坛

标题: 求助,折腾limit_req_module导致tenginge不能正常启动~! [打印本页]

作者: ivmm    时间: 2013-5-11 17:58
标题: 求助,折腾limit_req_module导致tenginge不能正常启动~!
  1. user  www www;

  2. worker_processes auto;

  3. error_log  /home/wwwlogs/nginx_error.log  crit;

  4. pid        /usr/local/nginx/logs/nginx.pid;
  5. google_perftools_profiles /tmp/tcmalloc;

  6. #Specifies the value for maximum file descriptors that can be opened by this process.
  7. worker_rlimit_nofile 51200;

  8. events
  9.         {
  10.                 use epoll;
  11.                 worker_connections 51200;
  12.         }

  13. http
  14.         {
  15.                 include       mime.types;
  16.                 default_type  application/octet-stream;

  17.                 server_names_hash_bucket_size 128;
  18.                 client_header_buffer_size 32k;
  19.                 large_client_header_buffers 4 32k;
  20.                 client_max_body_size 50m;

  21.                 sendfile on;
  22.                 tcp_nopush     on;

  23.                 keepalive_timeout 60;

  24.                 tcp_nodelay on;

  25.                 fastcgi_connect_timeout 300;
  26.                 fastcgi_send_timeout 300;
  27.                 fastcgi_read_timeout 300;
  28.                 fastcgi_buffer_size 64k;
  29.                 fastcgi_buffers 4 64k;
  30.                 fastcgi_busy_buffers_size 128k;
  31.                 fastcgi_temp_file_write_size 256k;

  32.                 gzip on;
  33.                 gzip_min_length  1k;
  34.                 gzip_buffers     4 16k;
  35.                 gzip_http_version 1.0;
  36.                 gzip_comp_level 2;
  37.                 gzip_types       text/plain application/x-javascript text/css application/xml;
  38.                 gzip_vary on;

  39.                 #limit_zone  crawler  $binary_remote_addr  10m;
  40.                 limit_req_zone $binary_remote_addr zone=one:3m rate=1r/s;
  41.               limit_req_zone $binary_remote_addr $uri zone=two:3m rate=1r/s;
  42.               limit_req_zone $binary_remote_addr $request_uri zone=three:3m rate=1r/s;

  43.                 #log format
  44.                 log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
  45.              '$status $body_bytes_sent "$http_referer" '
  46.              '"$http_user_agent" $http_x_forwarded_for';

  47. server
  48.         {
  49.                 listen       80;
  50.                 server_name www.mf8.biz;
  51.                 index index.html index.htm index.php;
  52.                 root  /home/www/default;

  53.                 location ~ .*\.(php|php5)?$
  54.                         {
  55.                                 try_files $uri =404;
  56.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  57.                                 fastcgi_index index.php;
  58.                                 include fcgi.conf;
  59.                         }
  60.                        
  61.               sysguard on;

  62.               sysguard_load load=10.5 action=/loadlimit;
  63.               sysguard_mem swapratio=20% action=/swaplimit;

  64.               location /loadlimit {
  65.                       return 503;
  66.              }

  67.               location /swaplimit {
  68.                       return 503;
  69.              }

  70.              location / {
  71.                       limit_req zone=one burst=5;
  72.                       limit_req zone=two forbid_action=@test1;
  73.                       limit_req zone=three burst=3 forbid_action=@test2;
  74.               }
  75.               
  76.                   location /off {
  77.                          limit_req off;
  78.               }

  79.               location @test1 {
  80.                       return 503;
  81.               }

  82.               location @test2 {
  83.                      return 503;
  84.               }

  85.                 location /status {
  86.                         stub_status on;
  87.                         access_log   off;
  88.                 }

  89.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  90.                         {
  91.                                 expires      30d;
  92.                         }

  93.                 location ~ .*\.(js|css)?$
  94.                         {
  95.                                 expires      12h;
  96.                         }

  97.                 access_log  /home/wwwlogs/access.log  access;
  98.         }
  99. include vhost/*.conf;
  100. }
复制代码
折腾那个Tengine的ngx_http_limit_req_module模块出错了,求助~~~

模块的内容:http://tengine.taobao.org/document_cn/http_limit_req_cn.html
作者: star826    时间: 2013-5-11 18:43
提示: 作者被禁止或删除 内容自动屏蔽
作者: ybs885    时间: 2013-5-11 19:16
没玩过
作者: lazyzhu    时间: 2013-5-11 19:21
什么错误提示???


作者: 111    时间: 2013-5-11 19:55
@小灰灰
作者: ivmm    时间: 2013-5-12 13:48
lazyzhu 发表于 2013-5-11 19:21
什么错误提示???

./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --with-http_limit_req_module=shared --with-http_sysguard_module --with-http_concat_module --with-google_perftools_module编译环境

作者: lazyzhu    时间: 2013-5-12 14:02
--with-http_limit_req_module=shared

需要加

dso {
     load http_limit_req_module.so;
}
作者: ivmm    时间: 2013-5-12 14:07
本帖最后由 ivmm 于 2013-5-12 14:08 编辑
lazyzhu 发表于 2013-5-12 14:02
--with-http_limit_req_module=shared

需要加


--with-http_limit_req_module=shared  用了无法编译啊

应该+在那个位置?
作者: lazyzhu    时间: 2013-5-12 14:08
ivmm 发表于 2013-5-12 14:07
--with-http_limit_req_module=shared  用了无法编译啊

默认就编译,不用加任何东西
作者: ivmm    时间: 2013-5-12 14:16
lazyzhu 发表于 2013-5-12 14:08
默认就编译,不用加任何东西

其实这个在编译里早+了。。

主要是
需要加

dso {
      load http_limit_req_module.so;
}

应该放在那个位置?

作者: lazyzhu    时间: 2013-5-12 14:21
ivmm 发表于 2013-5-12 14:16
其实这个在编译里早+了。。

主要是


是啊,不然我会要你加dso配置段???
http://tengine.taobao.org/document_cn/dso_cn.html

或者去掉 --with-http_limit_req_module=shared
limit_req_module 默认就包含了

作者: star826    时间: 2013-5-13 09:00
提示: 作者被禁止或删除 内容自动屏蔽
作者: lazyzhu    时间: 2013-5-13 09:04
star826 发表于 2013-5-13 09:00
那我是不是可以这样理解。

编译Tengine的时候不需要加 --with-http_limit_req_module=shared,因为已经 ...


http://tengine.taobao.org/document_cn/http_sysguard_cn.html
看这一段,你符合条件了吗?
注意,目前该模块仅对系统支持sysinfo函数时,才支持基于load与内存信息的保护,以及系统支持loadavg函数时支持基于load进行保护。模块需要从/proc文件系统中读取内存信息,模块默认没有编译,需要在编译时打开该模块: ./configure --with-http_sysguard_module



PS:不用tengine,也比你会用,这就是差距,
作者: star826    时间: 2013-5-13 09:16
提示: 作者被禁止或删除 内容自动屏蔽
作者: lazyzhu    时间: 2013-5-13 09:23
star826 发表于 2013-5-13 09:16
--with-http_sysguard_module 已经在编译的时候加入

连中文你看不懂吗,怎么装B?好吧我详细说一下吧

注意,目前该模块仅对系统支持sysinfo函数时,才支持基于load与内存信息的保护,以及系统支持loadavg函数时支持基于load进行保护。

这是系统的要求,linux一般都符合,其他unix,bsd未知。

模块需要从/proc文件系统中读取内存信息

这是程序的要求,nginx进程需要有读取/proc下文件的权限,自己在配置文件设置

模块默认没有编译,需要在编译时打开该模块: ./configure --with-http_sysguard_module
这是安装的要求,编译的时候加  --with-http_sysguard_module

够详细了吧,还搞不懂那我也没办法了



作者: star826    时间: 2013-5-13 09:25
提示: 作者被禁止或删除 内容自动屏蔽
作者: lazyzhu    时间: 2013-5-13 09:39
star826 发表于 2013-5-13 09:25
--with-http_sysguard_module 我都说了,编译的时候我已经加了。就是有的机器加了sysguard_mem free=100 ...

我帖子说了三个条件,你都符合了吗?
禁用了SWAP情况的答案 http://tengine.taobao.org/document_cn/http_sysguard_cn.html 上都有,你看不懂???

此帖OVER,我只提出思路方法,没时间帮你改配置

作者: star826    时间: 2013-5-13 09:42
提示: 作者被禁止或删除 内容自动屏蔽
作者: 404    时间: 2013-5-13 09:44
star826 发表于 2013-5-12 19:42
我明白了的。就是不签名那个机器怎么设置那个sysguard_mem free=100M action=/freelimit; 都用不了。其他 ...

openvz? openvz出现什么奇怪的事我都不会觉得奇怪的......
作者: star826    时间: 2013-5-13 10:07
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 全球主机交流论坛 (https://443502.xyz/) Powered by Discuz! X3.4