worker_connections 不够

worker_connections are not enough

我正在尝试访问部署在 nginx 中的 kibana 应用程序,但低于

URL :- http://127.0.0.1/kibana-3.1.2

2015/02/01 23:05:05 [alert] 3919#0: *766 768 worker_connections are not enough while connecting to upstream, client: 127.0.0.1, server: , request: "GET /kibana-3.1.2 HTTP/1.0", upstream: "http://127.0.0.1:80/kibana-3.1.2", host: "127.0.0.1"

Kibana 部署在 /var/www/kibana-3.1.2

我试过增加 worker_connections,但仍然没有运气,在这种情况下低于。

2015/02/01 23:02:27 [alert] 3802#0: accept4() failed (24: Too many open files)
2015/02/01 23:02:27 [alert] 3802#0: accept4() failed (24: Too many open files)
2015/02/01 23:02:27 [alert] 3802#0: accept4() failed (24: Too many open files)
2015/02/01 23:02:27 [alert] 3802#0: accept4() failed (24: Too many open files)
2015/02/01 23:02:27 [alert] 3802#0: accept4() failed (24: Too many open files)

nginx.conf :-

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

在下面的位置指令中。

location /kibana-3.1.2{

        proxy_set_header X-Real-IP  $remote_addr;

        proxy_set_header X-Forwarded-For $remote_addr;

        proxy_set_header Host $host;

        proxy_pass http://127.0.0.1;

        add_header Access-Control-Allow-Origin *;

        add_header Access-Control-Allow-Headers *;
       }

信息不够明确,但根据您提供的配置,您似乎有循环。您正在将请求代理到 localhost:80,但 NGINX 很可能正在侦听端口 80。因此,NGINX 一遍又一遍地连接到自身,因此出现关于打开文件过多的错误。

此外,Kibana 没有任何服务器端代码,因此 proxy_pass 在这里不合适。像下面这样的东西就足够了:

root /var/www/
location /kibana-3.1.2 {
    try_files $uri $uri/ =404;
}

话虽如此,如果您打算从 public 互联网访问它,您应该使用密码保护它,并且您应该在 elasticsearch 前面使用 proxy_pass 来控制什么可以向它提出请求。但那是另外一回事了:)

老问题,但我遇到了同样的问题,而接受的答案对我不起作用。

我不得不增加 worker_connections, as stated here 的数量。

/etc/nginx/nginx.conf

events {
    worker_connections 20000;
}

如果您 运行 在 docker 容器上连接到 php 容器,请在您的 nginx 配置或网站配置中将 fastcgi_pass 127.0.0.1:9000; 更改为 fastcgi_pass php:9000; 这是因为 nginx 指向 localhost 并认为它是他的同一个容器 运行 而不是路由到另一个容器