首页 > 系统相关 >nginx 并发限制limit_conn启动不了nginx

nginx 并发限制limit_conn启动不了nginx

时间:2023-05-12 17:35:02浏览次数:45  
标签:zone 连接数 nginx limit conn 页面

直接在http下写limit_conn启动不了nginx

基本语法
limit_conn 指令的基本语法为:

limit_conn connlimit;
1
其中,connlimit 为最大并发连接数。一旦某时刻,连接数超过该值,Nginx 将返回 503 错误页面并关闭新连接的接入。使用 error_page 指令可对此页面进行自定义配置。

除了主要指令之外,limit_conn 可用的其他一些参数包括:

limit_conn_zone:将连接数限制在完整区域范围内,而不是在整个 Nginx 实例中限制连接数。
limit_conn_log_level:日志等级,用于记录请求详细信息。
limit_conn_status:在错误页面中返回状态码。

解决方法:

http {
limit_conn_zone $binary_remote_addr zone=connzone:10m;
server {
location / {
limit_rate 20;
limit_conn connzone 1;
index index.html;
}
}
}

标签:zone,连接数,nginx,limit,conn,页面
From: https://www.cnblogs.com/leihongnu/p/17395789.html

相关文章

  • nginx源码安装步骤
    1、安装依赖包yuminstall-ygccyuminstall-ypcrepcre-develyuminstall-yzlibzlib-develyuminstall-yopensslopenssl-devel2、下载nginx源码包并解压 3、进入解压后的包nginx-1.16.1中4、执行命令 ./configure【参数可选:--prefix=/path/可指定ng......
  • window docker nginx容器 创建容器,把本地目录可以映射到nginx容器中
    在Windows环境下,您可以按照以下步骤创建一个映射了本地目录的Nginx容器:1.首先,创建一个本地目录,例如`C:\nginx`。2.使用以下命令启动Nginx容器,并将本地目录映射到容器中:```shdockerrun--namemy-nginx-p8080:80-vC:/nginx:/usr/share/nginx/html:ro-dnginx......
  • nginx优化的着手点
    Nginx通常需要处理大量的并发请求,为了提高性能和稳定性,使用Nginx作为反向代理服务器已成为一种常见的选择。然而,在使用Nginx时,还需要进行一些优化才能充分发挥其潜力,本文将介绍一些常见的Nginx优化技巧。1.合理配置worker_processNginx使用master-worker模型,其中mas......
  • Nginx中add_header和proxy_set_header的区别
    一、proxy_set_header和add_header的区别 proxy_set_header是nginx设置请求头给上游服务器,add_header是nginx设置响应头信息给浏览器。1.1proxy_set_header 语法格式: proxy_set_headerfieldvalue; value值可以是包含文本、变量或者它们的组合。......
  • 6.Nginx代理
    6.Nginx代理 安装Nginxsudoyuminstallnginx 启用和启动服务:sudosystemctlenablenginxsudosystemctlstartnginx 通过ip地址即可查看对应的欢迎页。http://118.25.251.113/usr/share/nginx/html 2、NGINX服务代理 进入/etc/nginx/文件夹修改nginx.co......
  • 自用nginx配置(常见安全配置,http转https,http和https混合请求,解决http host头攻击漏洞)
    自用nginx配置(常见安全配置,http转https,http和https混合请求,解决httphost头攻击漏洞)#usernobody;worker_processes1;#error_loglogs/error.log;#error_loglogs/error.lognotice;#error_loglogs/error.loginfo;#pidlogs/nginx.pid;events{w......
  • aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
    #解决:#1.aiohttp.TCPConnector(limit=0)=>aiohttp.TCPConnector(limit=10)#2.添加timeout=aiohttp.ClientTimeout(total=600)asyncdefget_data_main():#初始化数据库#db_utils.init_db('auto_search_uat.db')set_logging.set_get_data_log(......
  • Flink MySQL CDC connector 使用注意事项
    注意事项表要有主键库名和表名不能有点号是个BUG,估计后续会修复。表名不能有大写也是个BUG,估计后续会修复。如果表名含有大写的字母,查询时日志可看到如下信息:java.util.concurrent.ExecutionException:java.io.FileNotFoundException:Filedoesnotexist:hdf......
  • Visual Studio Connected Services 生成http api代码
    生成的代码将和接口对应的参数、返回值一一对应,本文底层使用的工具为NSwag.exe,其他可替代的方案还有AutoSet.exe1.配置连接2.配置生成的代码相关属性3.如果遇到报错考虑将version添加到生成的swagger.json文件中底层实际是调用NSwag.exe生成的代码生成的文件位置此......
  • nginx 10061: No connection could be made because the target machine actively ref
    nginx10061:Noconnectioncouldbemadebecausethetargetmachineactivelyrefusedit nginx重载配置一直有些不生效,查看后,发现nginx有4个,全部关闭掉,再重开nginx,正常了nginx.exe-squit,可以把正常的nginx退出掉,其他的nginx,任务管理器强制关闭掉startnginx开启nginx,o......