标签:default keep error etc www. config 测试 com 虚拟
nginx状态信息功能的介:
Nginx 在编译安装 Nginx 的时候添加 --with-http_stub_status_module 参数,其功能是记录 Nginx 的基本访问状态信息,让使用者了解 Nginx 的工作状态,
可以用 /application/nginx/sbin/nginx -V 来查看是否添加了ngx_http_stub_status_module 模块。
例如:
1、新建一个虚拟主机来配置 Nginx 状态信息功能
cat >>/application/nginx/conf/extra/status.conf<<eof
##status
server{
listen 80;
server_name status.jyw1.com;
location / {
stub_status on;
access_log off;
}
}
eof
2、修改nginx.conf配置文件
[root@lamp01 conf]# cat nginx.conf
worker_processes 1;
error_log logs/error.log error;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#nginx vhosts config
include extra/www.conf;
include extra/bbs.conf;
include extra/status.conf;
access_log logs/access_www.log main;
}
3、刷新配置:
[root@lamp01 conf]# /application/nginx/sbin/nginx -t nginx: the configuration file /application/nginx-1.6.3/conf/nginx.conf syntax is ok nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test is successful [root@lamp01 conf]# /application/nginx/sbin/nginx -s reload
4、修改本地 hosts解析
echo "192.168.43.118 status.jyw1.com" >>/etc/hosts
5、测试效果:
状态信息解释:
在开启 keep-alive 的情况下,Waiting = Active connections - (Reading + Writing)
标签:default keep error etc www. config 测试 com 虚拟
原文地址:https://www.cnblogs.com/su-root/p/10236252.html