Nginx的常用模块配置

1、http_stub_status_module模块
作用:用来显示当前服务器的连接请求状态信息

[root@localhost ~]# vim /etc/nginx/conf.d/default.conf 
server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

   location /mystatus {                       //添加此location选项,定义状态信息页面;
        stub_status;                         //添加状态信息关键字;
   }



[root@localhost ~]# nginx -c  /etc/nginx/nginx.conf   -s reload     //对服务做重载
[root@localhost ~]# ss -tunlp | grep nginx 
tcp    LISTEN     0      128                    *:80                    *:*      users:(("nginx",1756,6),("nginx",4238,6))
[root@localhost ~]# 

在这里插入图片描述

Active connections: 2                  //活动状态的连接数
server accepts handled requests       //accept:已接收的客户端请求数量;
									    handled:已处理的客户端请求数量
									    requests:客户端发送的总请求数
 2 2 1 
Reading: 0 Writing: 1 Waiting: 1    // Reading:正在读取客户端请求报文首部的连接数;
								       Writing:正在向客户端发送响应报文的连接数;
								       Waiting:正在等待客户端发送请求报文的空闲连接数;

2、http_random_index_module模块
作用:客户端发起请求时,在页面目录中随机选择一个主页返回给用户

[root@localhost ~]# mkdir /opt/test/web   -pv
mkdir: 已创建目录 "/opt/te
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值