宝塔618特惠活动,企业版999元/年,宝塔SSL证书买1送1!限时抢购!查看活动
当前位置:论坛首页 > Windows面板 > 求助

【已解答】nginx 反向代理域名访问间歇性卡慢

发表在 Windows面板2023-2-24 19:22 [复制链接] 2 3708

        用宝塔创建了一个域名反向代理到本地的另一个端口号        用域名访问网站偶尔会出现卡慢但是能打开
QQ截图20230224191400.png
       initial  connection 响应时间特别长。但是用IP+端口访问就特别快。

反向代理配置内容
  1. location /
  2. {
  3.     expires 12h;
  4.     if ($request_uri ~* "(php|jsp|cgi|asp|aspx)")
  5.     {
  6.          expires 0;
  7.     }
  8.     proxy_pass http://127.0.0.1:8588;
  9.     proxy_set_header Host $host;
  10.     proxy_set_header X-Real-IP $remote_addr;
  11.     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  12.     proxy_set_header REMOTE-HOST $remote_addr;

  13.     add_header X-Cache $upstream_cache_status;

  14.     proxy_set_header Accept-Encoding "";
  15.         
  16.     sub_filter_once off;

  17.     proxy_cache cache_one;
  18.     proxy_cache_key $host$uri$is_args$args;
  19.     proxy_cache_valid 200 304 301 302 12h;
  20. }
复制代码
nginx 配置
  1. worker_processes auto;
  2. worker_rlimit_nofile 51200;
  3. events
  4. {
  5.         worker_connections 51200;
  6.         multi_accept on;
  7. }
  8. http {
  9.                 include       mime.types;
  10.                 #include luawaf.conf;
  11.                 include proxy.conf;
  12.         default_type  application/octet-stream;

  13.         server_names_hash_bucket_size 512;
  14.         client_header_buffer_size 32k;
  15.         large_client_header_buffers 4 32k;
  16.         client_max_body_size 50m;

  17.         sendfile   on;
  18.         tcp_nopush on;

  19.         keepalive_timeout 60;

  20.         tcp_nodelay on;

  21.         fastcgi_connect_timeout 300;
  22.         fastcgi_send_timeout 300;
  23.         fastcgi_read_timeout 300;
  24.         fastcgi_buffer_size 64k;
  25.         fastcgi_buffers 4 64k;
  26.         fastcgi_busy_buffers_size 128k;
  27.         fastcgi_temp_file_write_size 256k;
  28.                 fastcgi_intercept_errors on;

  29.         gzip on;
  30.         gzip_min_length  1k;
  31.         gzip_buffers     4 16k;
  32.         gzip_http_version 1.1;
  33.         gzip_comp_level 2;
  34.         gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
  35.         gzip_vary on;
  36.         gzip_proxied   expired no-cache no-store private auth;
  37.         gzip_disable   "MSIE [1-6]\.";

  38.         limit_conn_zone $binary_remote_addr zone=perip:10m;
  39.                 limit_conn_zone $server_name zone=perserver:10m;

  40.         server_tokens off;
  41.         access_log off;

  42.     server {
  43.         listen       80;
  44.         server_name  127.0.0.1;

  45.         #charset koi8-r;

  46.         #access_log  logs/host.access.log  main;

  47.         location / {
  48.             root   html;
  49.             index  index.html index.htm;
  50.         }
  51.                 location /nginx_status {  
  52.                 allow 127.0.0.1;
  53.             deny all;
  54.             stub_status on;  
  55.             access_log  off;  
  56.         }  
  57.     }
  58.     include vhost/*.conf;
  59.     #加载vhost目录下的虚拟主机配置文件
  60. }
复制代码


使用道具 举报 只看该作者 回复
发表于 2023-2-24 19:56:06 | 显示全部楼层
您好,您可尝试修改nginx配置文件此参数后再重启nginx访问试试
  1. worker_connections 65535;
复制代码

居然神奇的就不会卡慢了,非常感谢  发表于 2023-2-24 20:34
使用道具 举报 回复 支持 1 反对 0
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

普通问题处理

论坛响应时间:72小时

问题处理方式:排队(仅解答)

工作时间:白班:9:00 - 18:00

紧急运维服务

响应时间:3分钟

问题处理方式:宝塔专家1对1服务

工作时间:工作日:9:00 - 18:30

宝塔专业团队为您解决服务器疑难问题

点击联系技术免费分析

工作时间:09:00至18:30

快速回复 返回顶部 返回列表