CB2 + Nginx STOP Periodically

rnc

Verified User
Joined
Jun 8, 2013
Messages
72
Hello
i installed nginx on a new server with custombuild 2 as webserver

nginx crash/hang/stop in almost same time frames ( or maybe heavy loads )
server is Vmware machine with 2 core of E5-1620 CPU + 8GB RAM
the network interface trrafic is around 100Mbps ( 200~300Mbps Expected )
the server is a file download server and not host any database or active php script

here is the information
Code:
nginx -v
nginx version: nginx/1.4.


Code:
#user  nginx;
worker_processes  2;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

events {
    worker_connections  102400;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    tcp_nopush on;
    tcp_nodelay on;
    sendfile        on;

    log_format bytes '$bytes_sent $request_length';


    keepalive_timeout  2;
    types_hash_max_size 2048;
autoindex on;
autoindex_exact_size off;
    gzip on;
    gzip_static on;
    gzip_disable "msie6";
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;

    server_tokens off;

#    client_max_body_size 1024m;
#   client_body_buffer_size 128k;

    server_names_hash_bucket_size 128;
    server_names_hash_max_size 1024;

    include /etc/nginx/directadmin-ips.conf;

    server {
        listen       x.x.x.x:80;
        server_name  $hostname x.x.x.x;

        root   /var/www/html;
        index  index.html index.htm index.php;

        # Pass all .php files onto a php-fpm/php-fcgi server.
        location ~ \.php$ {
                try_files $uri =404;


                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include /etc/nginx/fastcgi_params;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass unix:/usr/local/php53/sockets/webapps.sock;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}

        location /squirrelmail {
               root /var/www/html/;
               index index.php index.html index.htm;
               location ~ ^/squirrelmail/(.+\.php)$ {
                       try_files $uri =404;
                       root /var/www/html/;
                       fastcgi_pass unix:/usr/local/php53/sockets/webapps.sock;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
                        include /etc/nginx/nginx_limits.conf;
               }
               location ~* ^/squirrelmail/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /var/www/html/;
               }
        }

        location /roundcube {
               root /var/www/html/;
               index index.php index.html index.htm;
               location ~ ^/roundcube/(.+\.php)$ {
                       try_files $uri =404;
                       root /var/www/html/;
                       fastcgi_pass unix:/usr/local/php53/sockets/webapps.sock;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
                        include /etc/nginx/nginx_limits.conf;
               }
               location ~* ^/roundcube/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /var/www/html/;
               }
        }

        location /phpMyAdmin {
               root /var/www/html/;
               index index.php index.html index.htm;
               location ~ ^/phpMyAdmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /var/www/html/;
                       fastcgi_pass unix:/usr/local/php53/sockets/webapps.sock;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
                        include /etc/nginx/nginx_limits.conf;
               }
               location ~* ^/phpMyAdmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /var/www/html/;
               }
        }

        location /phpmyadmin {
               rewrite ^/* /phpMyAdmin last;
        }

        location /pma {
               rewrite ^/* /phpMyAdmin last;
        }

        location /webmail {
               rewrite ^/* /roundcube last;
        }
    }

    # HTTPS server
    #
    server {
        listen       x.x.x.x:443;
        server_name  $hostname x.x.x.x;

        ssl                  on;
        ssl_certificate      /etc/nginx/ssl.crt/server.crt;
        ssl_certificate_key  /etc/nginx/ssl.key/server.key;

        ssl_session_cache    shared:SSL:10m;
        ssl_session_timeout  10m;

        ssl_protocols  SSLv2 SSLv3 TLSv1;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers   on;

        root   /var/www/html;
        index  index.html index.htm index.php;

        # Pass all .php files onto a php-fpm/php-fcgi server.
        location ~ \.php$ {
                try_files $uri =404;

                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include /etc/nginx/fastcgi_params;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass unix:/usr/local/php53/sockets/webapps.sock;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}

        location /squirrelmail {
               root /var/www/html/;
               index index.php index.html index.htm;
               location ~ ^/squirrelmail/(.+\.php)$ {
                       try_files $uri =404;
                       root /var/www/html/;
                       fastcgi_pass unix:/usr/local/php53/sockets/webapps.sock;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
                       fastcgi_buffer_size 128k;
                       fastcgi_buffers 256 16k;
                       fastcgi_busy_buffers_size 256k;
                       fastcgi_temp_file_write_size 256k;
                       fastcgi_intercept_errors on;
                       fastcgi_read_timeout 240;
               }
               location ~* ^/squirrelmail/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /var/www/html/;
               }
        }

        location /roundcube {
               root /var/www/html/;
               index index.php index.html index.htm;
               location ~ ^/roundcube/(.+\.php)$ {
                       try_files $uri =404;
                       root /var/www/html/;
                       fastcgi_pass unix:/usr/local/php53/sockets/webapps.sock;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
                       fastcgi_buffer_size 128k;
                       fastcgi_buffers 256 16k;
                       fastcgi_busy_buffers_size 256k;
                       fastcgi_temp_file_write_size 256k;
                       fastcgi_intercept_errors on;
                       fastcgi_read_timeout 240;
               }
               location ~* ^/roundcube/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /var/www/html/;
               }
        }

        location /phpMyAdmin {
               root /var/www/html/;
               index index.php index.html index.htm;
               location ~ ^/phpMyAdmin/(.+\.php)$ {
                       try_files $uri =404;
                       root /var/www/html/;
                       fastcgi_pass unix:/usr/local/php53/sockets/webapps.sock;
                       fastcgi_index index.php;
                       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                       include /etc/nginx/fastcgi_params;
                       fastcgi_buffer_size 128k;
                       fastcgi_buffers 256 16k;
                       fastcgi_busy_buffers_size 256k;
                       fastcgi_temp_file_write_size 256k;
                       fastcgi_intercept_errors on;
                       fastcgi_read_timeout 240;
               }
               location ~* ^/phpMyAdmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                       root /var/www/html/;
               }
        }

        location /phpmyadmin {
               rewrite ^/* /phpMyAdmin last;
        }

        location /pma {
               rewrite ^/* /phpMyAdmin last;
        }

        location /webmail {
               rewrite ^/* /roundcube last;
        }
    }
    include /etc/nginx/directadmin-settings.conf;
    include /etc/nginx/nginx-includes.conf;
    include /etc/nginx/directadmin-vhosts.conf;
}



also i have another problem that nginx

need to be first killed by killall first then it will be start !
Code:
service nginx restart
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Stopping nginx:                                            [  OK  ]
Starting nginx:


killall nginx
or
killall -9 nginx

and then
service will be starter

Code:
killall nginx
service nginx restart
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Stopping nginx:                                            [FAILED]
Starting nginx:              [  OK  ]
 
Please check nginx error log and post us the errors here. Thank you.
 
Please check nginx error log and post us the errors here. Thank you.

Hello !
o forget the most important part

the error is like this ( this error is the last error when nginx stop working ) but the kill and restart does it must have error ?
2013/08/15 01:44:17 [alert] 5383#0: open socket #113 left in connection 288
2013/08/15 01:44:17 [alert] 5383#0: open socket #358 left in connection 423
2013/08/15 01:44:17 [alert] 5383#0: open socket #134 left in connection 1230
2013/08/15 01:44:17 [alert] 5383#0: open socket #121 left in connection 1240
2013/08/15 01:44:17 [alert] 5383#0: open socket #388 left in connection 1654
2013/08/15 01:44:17 [alert] 5383#0: aborting
 
Hello again
Martynas may i have your great support here ?
 
There is not much said about the problem here, however, I could check your server and tell you where is the problem is.
 
There is not much said about the problem here, however, I could check your server and tell you where is the problem is.

Hello
thanks
The problem is simple
the nginx stop working with the error that i said
and than i need to restart it with
Code:
killall nginx
service nginx restart

also i send nginx configuration
what could cause this error ?
 
can you first please tell me why you are serving so many worker_connections? Please first stick to 1024 and try to raise only if needed. Please also update you worker_processes to 4. 2 cores means 4 worker_processes.
 
can you first please tell me why you are serving so many worker_connections? Please first stick to 1024 and try to raise only if needed. Please also update you worker_processes to 4. 2 cores means 4 worker_processes.

hello this was a misunderstand of concept pg worker_connection
i changed to 1024
but why 4 processes
this server have 2 core cpu
thanks for the response
 
please also take a look if the httpd deamon is disabled. Look in the /etc/init.d/ is it says httpd. If so please disable with the following commands:
/etc/init.d/httpd stop
chkconfig httpd off
chmod 0 /etc/init.d/httpd
 
Hello
problem is still there
what this error mean ?

2013/08/15 01:44:17 [alert] 5383#0: open socket #113 left in connection 288
2013/08/15 01:44:17 [alert] 5383#0: open socket #358 left in connection 423
2013/08/15 01:44:17 [alert] 5383#0: open socket #134 left in connection 1230
2013/08/15 01:44:17 [alert] 5383#0: open socket #121 left in connection 1240
2013/08/15 01:44:17 [alert] 5383#0: open socket #388 left in connection 1654
2013/08/15 01:44:17 [alert] 5383#0: aborting
 
Hello again
the error is still there and the problem is occurred each day at almost same time in the morning !
 
hello
i still have problem and directadmin direct support dont have clear answer for this problem too

why this problem must happen on server that i have
i remember that i have another server that have same situation !

i have to wake up every day at specific time to kill nginx process and start it again!
how could be possible to nginx stop serving request at specific time ?

these days when it stop working there is no sign of aborting error !
and just


root 7261 0.0 0.0 103304 864 pts/1 S+ 00:38 0:00 grep nginx
root 14609 0.0 0.0 57852 4684 ? Ss Sep08 0:00 nginx: master process /usr/sbin/ngi nx -c /etc/nginx/nginx.conf
nginx 14610 0.3 0.1 63884 11656 ? S Sep08 3:39 nginx: worker process is shutting d own
nginx 14611 0.3 0.0 59964 7692 ? S Sep08 3:30 nginx: worker process is shutting d own
nginx 14613 0.3 0.1 62224 9992 ? S Sep08 3:37 nginx: worker process is shutting d own
nginx 14614 0.3 0.0 59448 7204 ? S Sep08 3:39 nginx: worker process is shutting d own
root 14976 0.0 0.0 107536 1332 pts/2 S Sep08 0:26 watch sh nginxmonitor-error.sh


ive created a watchdog script to monitor nginx aborting error and kill and restart service when error appeared ! but that time after there is no sign of nginx aborting error in log !
 
I have the exact same issue. When you change something in DirectAdmin (for example in Custom HTTPD Configurations), then nginx will not work anymore. You have to do "killall nginx" and "service nginx start".

It is very annoying, did anybody find a solution already?
 
Hello,

Although we're new to nginx, when googling on how to enable debugging in the logs, in the nginx documentation, the mentioned error showed up under the section "Socket Leaks":
http://wiki.nginx.org/Debugging#Socket_leaks

Further googling seemed to imply that nginx plugins can sometimes cause the issues.
eg: http://forum.nginx.org/read.php?29,239511,239555#msg-239555

Beyond that, we're not familiar with nginx enough to give a detailed explanation as to the cause of socket leaks.

If you are running any nginx plugins, try disabling them.
Beyond that, with the limited lifetime of nginx with custombuild, we're yet not sure what issues might exist.
For stable productions systems, we have far more experience and time with Apache, which would be the fall-back plan.

John
 
I have the exact same issue. When you change something in DirectAdmin (for example in Custom HTTPD Configurations), then nginx will not work anymore. You have to do "killall nginx" and "service nginx start".

It is very annoying, did anybody find a solution already?

Please check if you still experience the same problem with DA 1.44.1.
 
Back
Top