• 查看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]}'

  • 相关阅读:
    golang面试题总结
    7.前端笔记-CSS-元素显示模式
    今年这300道Java岗面试真题,闷头硬背
    (学习日记)2022.8.11
    B. Sets and Union
    Pytorch人体姿态骨架生成图像
    详解kafka中的消息日志文件:Topic消息分类、partition分区、segment分段、offset偏移量索引文件
    暴雪退游,网易独行
    【JavaEE】idea的smart tomcat插件
    放下宝宝就醒,告诉你是因为什么
  • 原文地址:https://blog.csdn.net/qq285744011/article/details/126030167