Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am facing the problem of nginx max connection issues. I am not able to increase max active connections(520) made by nginx. Some time it is using whole writing (516) operation connections. and due to this other requests are all pending.

Does anybody know how to increase nginx active max connections.

Using CentOS release 5.8 (Final)

NGINX status: Active connections: 519 server accepts handled requests 4693 4693 1276317 Reading: 2 Writing: 1 Waiting: 516

NGINX conf file: user nginx root; worker_processes 16; worker_rlimit_nofile 200000;

worker_connections 10240;

error_log /var/log/nginx/error.log;

error_log /var/log/nginx/error.log notice;

error_log /var/log/nginx/error.log info;

pid /var/run/nginx.pid;

events { worker_connections 10240; use epoll; }

http { include /etc/nginx/mime.types; default_type application/octet-stream; index index.php index.htm index.html; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  /var/log/nginx/access.log  main;
access_log off;

sendfile        on;
tcp_nopush      on;
tcp_nodelay     on;
server_tokens   off;
gzip            on;
gzip_static     on;
gzip_comp_level 5;
gzip_min_length 10240;
keepalive_timeout  30;
keepalive_requests 100000;
limit_conn_zone   $binary_remote_addr  zone=addr:10m;

# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;

server {
    limit_conn addr 20000;
    listen       7007;
    server_name  _;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;
        root   /usr/share/nginx/html;
    location / {

root /usr/share/nginx/html;

index index.html index.htm;

    }

    error_page  404              /404.html;

    location = /404.html {

root /usr/share/nginx/html;

    }
  location /favicon.ico {
      empty_gif;
  }
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {

root /usr/share/nginx/html;

    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {

root /usr/share/nginx/html;

        #fastcgi_pass   localhost:9000;
        fastcgi_pass   unix:/tmp/php.sock;
        fastcgi_index  index.php;
        #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #include        fastcgi_params;
      fastcgi_send_timeout  8m;
      fastcgi_read_timeout 8m;
      fastcgi_connect_timeout 8m;
      #uwsgi_pass_request_body off;
      include /etc/nginx/fastcgi.conf;
    }

  location /status {
        stub_status on;
          access_log   off;
     }

} }

Also I have set these information too for increasing max connection cat /proc/sys/net/ipv4/ip_local_port_range 9000 65535

cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_time_wait 1

But thease setting are not working.

If you need any other information please notify me.

Thanks

share|improve this question

1 Answer 1

do you get anything in the logfiles, indicationg xxx_limits reached or so? i think of /etc/security/limits.conf.

we had a similar issue for a static-server under fire where we had to adjust and increase the limits

share|improve this answer
    
We have already increase the ulimit according to eddieoneverything.com/linux/… as we are using whm. But the limit of max active connection has not been increase from 520. And I didn't see anything in var/log/messages log of limits reached. Could you please tell us is there any other way to increase limit of nginx? –  Vikas Jul 18 '13 at 9:35
    
you should ask this question on the nginx-forum –  that guy from over there Jul 18 '13 at 9:42
    
btw, is this a centos-version or a selfcompiled version of nginx? –  that guy from over there Jul 18 '13 at 10:41
    
It is compiled version from the source code. –  Vikas Jul 18 '13 at 10:49
    
oih, and can you please reedit your question and adjust the formatiting of your nginx.conf? quite hard to read :) –  that guy from over there Jul 18 '13 at 11:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.