这是我的configuration(Nginx 1.7.x):
server { listen 8000; index index.php index.html index.htm; root /var/www/; server_tokens off; chunked_transfer_encoding off; location ~ \.php$ { try_files $uri =404; fastcgi_index index.php; fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; fastcgi_keep_conn on; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } }
和php-fpmconfiguration:
[www] user = www-data group = www-data listen = /var/run/php5-fpm.sock listen.owner = www-data listen.group = www-data listen.allowed_clients = 127.0.0.1 pm = ondemand pm.max_children = 6000; pm.process_idle_timeout = 5; chdir = / security.limit_extensions = .php php_flag[display_errors] = on php_flag[display_startup_errors] = on
我有一个PHP脚本,我将LIVE DATA发送给客户端。当客户端closures连接时,我可以看到PID在15-20秒后closures 。 我认为这是由于缓冲区和nginx的工作方式。
例如,如果我通过设置fastcgi_bufferingclosures 客户端的连接即时closuresnginx / fastcgi缓冲。
但是,如果findnginx缓冲对于我来说减less客户端的任何延迟是非常重要的。
那么有没有什么办法可以让nginx / php在客户端断开连接时立即获得事件?
谢谢