You get a bonus - 1 coin for daily activity. Now you have 1 coin

NGINX errors [alert] 1 open socket left in connection [alert] aborting

Practice



NGINX errors [alert] 1 open socket left in connection

Main nginx settings /etc/nginx/nginx.conf


user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
http {

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 20;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;

gzip on;
gzip_disable "msie6";

.....

Error log

2018/04/07 09:27:24 [alert] 22148#22148: *9146 open socket #63 left in connection 33
2018/04/07 09:27:24 [alert] 22148#22148: *9188 open socket #55 left in connection 43
2018/04/07 09:27:24 [alert] 22148#22148: *9149 open socket #69 left in connection 60
2018/04/07 09:27:24 [alert] 22148#22148: *9147 open socket #67 left in connection 62
2018/04/07 09:27:24 [alert] 22148#22148: aborting
2018/04/07 09:39:40 [alert] 23446#23446: *849 open socket #59 left in connection 18
2018/04/07 09:39:40 [alert] 23446#23446: aborting
2018/04/07 09:39:40 [alert] 23445#23445: *950 open socket #53 left in connection 8
2018/04/07 09:39:40 [alert] 23445#23445: *949 open socket #50 left in connection 19
2018/04/07 09:39:40 [alert] 23445#23445: *954 open socket #49 left in connection 29
2018/04/07 09:39:40 [alert] 23445#23445: aborting
2018/04/07 09:48:06 [alert] 24112#24112: *498 open socket #52 left in connection 14
2018/04/07 09:48:06 [alert] 24112#24112: aborting
2018/04/07 09:48:14 [alert] 24933#24933: *9 open socket #51 left in connection 9
2018/04/07 09:48:14 [alert] 24933#24933: *10 open socket #52 left in connection 10
2018/04/07 09:48:14 [alert] 24933#24933: aborting
2018/04/07 09:48:29 [alert] 25256#25256: *4 open socket #49 left in connection 7
2018/04/07 09:48:29 [alert] 25256#25256: aborting
2018/04/07 09:53:09 [alert] 25657#25657: *342 open socket #59 left in connection 27
2018/04/07 09:53:09 [alert] 25657#25657: aborting
2018/04/07 19:11:20 [alert] 489#489: *1291 open socket #56 left in connection 16
2018/04/07 19:11:20 [alert] 488#488: *1278 open socket #64 left in connection 7
2018/04/07 19:11:20 [alert] 489#489: aborting
2018/04/07 19:11:20 [alert] 488#488: aborting


Changing the worker_connections and keepalive_timeout parameters doesn't really affect how often the errors occur.. moreover nginx crashes completely and no other site can connect at that moment, while Apache doesn't go down and there are no errors in its logs

Comments

Артем 07-04-2018
Подробный анализ всех доменов на сервере выявило то что была большая нагрузка от одного поисковой системы на просмотр изображений.. временно запретил доступ к просмотру изображений для поисковых систем через robots .htaccess

.htaccess:


RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} (googlebot|bingbot|^Google*|^Yandex*|^Ma il*|^Go!*|Baiduspider|YandexBot/3.0|Yand exImages/3.0) [NC]
RewriteRule \.(jpe?g|gif|bmp|png)$ - [R=403,L]



robots.txt :


Host: site.com

User-agent: *
Disallow: /img
Disallow: /img/*






To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Running server side scripts using PHP as an example (LAMP)"

Terms: Running server side scripts using PHP as an example (LAMP)