码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 查看nginx当前并发连接数 - 修改最高并发数


    效果

     

    修改并发数步骤

    1. 安装好nginx
    2. 修改nginx配置文件nginx.conf,例如:
      D:\SystemKits\Laragon\bin\nginx\nginx-1.19.10\conf\nginx.conf

      找到并修改:
      events {
          worker_connections  1024;
      }
      的数量
    3. 重启nginx

    查看当前nginx连接数(在线查看)

    1. 安装好nginx,配置好一个本地域名,例如 suibian.com
    2. 找到这个站点的配置文件,例如:
      D:\SystemKits\Laragon\etc\nginx\sites-enabled\suibian.com.conf
      (本来文件是auto.suibian.com.conf,因为Laragon的机制需要删掉“auto.”前缀,按需修改)
    3. 在server {}标签里面添加一条路由设置:
      1. location /status {
      2. stub_status on;
      3. auth_basic "NginxStatus";
      4. }

      其中“/status”是可以自定义的测试网址,可以改其他名字

    4. 完整的一个站点配置:
      1. server {
      2. listen 80;
      3. server_name suibian.com *.suibian.com;
      4. root "D:/SystemKits/Laragon/www/suibian";
      5. index index.html index.htm index.php;
      6. location / {
      7. try_files $uri $uri/ /index.php$is_args$args;
      8. autoindex on;
      9. }
      10. location ~ \.php$ {
      11. include snippets/fastcgi-php.conf;
      12. fastcgi_pass php_upstream;
      13. #fastcgi_pass unix:/run/php/php7.0-fpm.sock;
      14. }
      15. location /status {
      16. stub_status on;
      17. auth_basic "NginxStatus";
      18. }
      19. charset utf-8;
      20. location = /favicon.ico { access_log off; log_not_found off; }
      21. location = /robots.txt { access_log off; log_not_found off; }
      22. location ~ /\.ht {
      23. deny all;
      24. }
      25. }
      26. # This file is auto-generated.
      27. # If you want Laragon to respect your changes, just remove the [auto.] prefix
      28. # If you want to use SSL, enable it at: Menu > Nginx > SSL > Enabled

    5. 重启nginx
    6. 打开 http://suibian.com/status 即可看到nginx的连接数

    ok~

    可以看到有些连接是卡住的,waiting....

     查看当前nginx连接数(命令查看)

    netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

  • 相关阅读:
    【云原生 | Kubernetes 系列】----Grafana 安装
    OpenAI宫斗大戏,奥特曼面临的选择
    【Node.js+koa--后端管理系统】设计动态发布、修改、查询、删除接口
    【Java集合】聊聊Hashmap的哈希函数、扩容、树化
    Golang可能会踩的58个坑之初级篇
    CSS简介
    云原生路由架构探索
    短视频矩阵系统源码技术独立部署搭建
    ESP32C3 LuatOS RC522①写入数据并读取M1卡
    新手上路:学会使用SELinux保护你的系统
  • 原文地址:https://blog.csdn.net/qq285744011/article/details/126030167
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号