色魔王子7 发表于 2018-11-14 13:20:14

nginx配置状态模块报错

# /application/nginx/sbin/nginx-t  

  nginx: invalid number of arguments in "stub_status" directive in /application/nginx-1.6.3/conf/extra/status.conf:4
  nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test faile
  检查 /application/nginx/sbin/nginx   -V
  nginx version: nginx/1.6.3
  built by gcc 4.4.7 20120313 (Red Hat 4.4.7-23) (GCC)
  TLS SNI support enabled
  configure arguments: --prefix=/application/nginx-1.6.3 --user=www --group=www --with-http_stub_status_module --with-http_ssl_module
  如果没有 --with-http_stub_status_module模块需要安装
  在对应目录下执行编译安装三部曲
  ./configure –with-http_stub_status_module
  make && make install
  # cat www.conf
  server {
  listen       80;
  server_name对应的域名;
  location / {
  root   html/www;
  indexindex.html index.htm;
  }
  #这个就是要需要开启的监控模块
  #注意要在指定的server标签下加入 就是监控哪个域名
  location /nginx_status {
  stub_status on;
  access_log off;
  #加入访问限制

allowIP地址;

allowIP地址;

deny all
  

      }  error_page   500 502 503 504/50x.html;
  location = /50x.html {
  root   html;
  }
  
}
  

  然后平滑重启
  


  # /application/nginx/sbin/nginx-s>  

  在网址输入对应的域名
  域名/nginx_status
  Active connections: 2
  server accepts handled requests
  74 74 111
  Reading: 0 Writing: 1 Waiting: 1
  Active connections: 对后端发起的活动连接数.
  Server accepts handled requests: Nginx总共处理了74个连接,成功创建74次握手(证明中间没有失败的),总共处理了111个请求.
  Reading: Nginx 读取到客户端的Header信息数.
  Writing: Nginx 返回给客户端的Header信息数.
  Waiting: 开启keep-alive的情况下,这个值等于 active – (reading + writing),意思就是Nginx已经处理完成,正在等候下一次请求指令的驻留连接。


页: [1]
查看完整版本: nginx配置状态模块报错