nginx file straming

Adrian Janeczek nginx-forum at nginx.us
Thu Dec 29 18:20:04 UTC 2011


Hello
I have problem with nginx
When my server sream big files + 1024MB via firefox or other browser the
connect is reseting (file szise is 4gb but download only 1000 - 1157) 
I use php-fpm

dominian conf

upstream php_fpm {
server unix:/var/run/php-fpm/php-fpm.sock;
}

server 
{
	listen 80;
	server_name  v10.server.me;

	access_log  /var/log/nginx/access.log;
	error_log  	/var/log/nginx/error.log;
	
	proxy_buffers 8 16k;
	proxy_buffer_size 32k;

	client_header_timeout 120;
	client_body_timeout 120;
	send_timeout 120;
	
		location / 
		{
			root /var/www;
			index  index.php index.html index.htm;		
		error_page   404 = http://direct.rapidox.pl/404.php;
		#error_page   502 503 504 = http://direct.rapidox.pl/502.php;
		rewrite ^/file/([^/]+)/(.*)$ /download.php?kod=$1&filename=$2 last;
		location ~ .php$ 
				{
						fastcgi_split_path_info ^(.+\.php)(.*)$;
						fastcgi_pass   php_fpm;
						fastcgi_index  index.php;
						fastcgi_param  SCRIPT_FILENAME
$document_root$fastcgi_script_name;
						include fastcgi_params;
						fastcgi_param  QUERY_STRING     $query_string;
						fastcgi_param  REQUEST_METHOD   $request_method;
						fastcgi_param  CONTENT_TYPE     $content_type;
						fastcgi_param  CONTENT_LENGTH   $content_length;
						fastcgi_intercept_errors        on;
						fastcgi_ignore_client_abort     off;
						fastcgi_connect_timeout 60;
						fastcgi_send_timeout 180;
						fastcgi_read_timeout 180;
						fastcgi_buffer_size 128k;
						fastcgi_buffers 4 256k;
						fastcgi_busy_buffers_size 256k;
						fastcgi_temp_file_write_size 256k;
				}
				
		location = /php_status {
			include /etc/nginx/fastcgi_params;
			fastcgi_param SCRIPT_FILENAME /php_status;
			fastcgi_pass	php_fpm;
			access_log off;
		}
	
		location /nginx_status {
			stub_status on;
			access_log   off;
		}
	}
}
and nginx.conf
user www-data;
worker_processes 2;
worker_rlimit_nofile 16384;
worker_rlimit_sigpending 32768;
worker_priority -5;
#worker_cpu_affinity 01000000 00100000 00010000 10000000 00001000
00000100 00000010 00000001;

pid /var/run/nginx.pid;

events {
	worker_connections 2048;
	multi_accept on;
	use epoll;
}

http {

	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

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

	##
	# Logging Settings
	##

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

	##
	# Gzip Settings
	##

	gzip on;
	gzip_disable "msie6";

	# gzip_vary on;
	# gzip_proxied any;
	# gzip_comp_level 6;
	# gzip_buffers 16 8k;
	# gzip_http_version 1.1;
	# gzip_types text/plain text/css application/json
application/x-javascript text/xml application/xml application/xml+rss
text/javascript;

	include /etc/nginx/sites-enabled/*;
}
 
and fpm worker conf 
[www]
listen = /var/run/php-fpm/php-fpm.sock
;listen.backlog = -1
;listen.allowed_clients = 127.0.0.1
listen.owner = www-data
listen.group = www-data
;listen.mode = 0666
user = www-data
group = www-data
pm                   = dynamic
pm.max_requests      = 0
pm.max_children      = 75
pm.start_servers     = 10
pm.min_spare_servers = 10
pm.max_spare_servers = 50
pm.status_path       = /php_status
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f
no-reply at server.me
php_flag[display_errors] = On
php_admin_value[memory_limit] = 1024M

and fpm conf

;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;

; All relative paths in this configuration file are relative to PHP's
install
; prefix (/usr). This prefix can be dynamicaly changed by using the
; '-p' argument from the command line.

; Include one or more files. If glob(3) exists, it is used to include a
bunch of
; files from a glob(3) pattern. This directive can be used everywhere in
the
; file.
; Relative path can also be used. They will be prefixed by:
;  - the global prefix if it's been set (-p arguement)
;  - /usr otherwise
;include=/etc/php5/fpm/*.conf

;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
; Pid file
; Note: the default prefix is /var
; Default Value: none
pid = /var/run/php5-fpm.pid

; Error log file
; Note: the default prefix is /var
; Default Value: log/php-fpm.log
error_log = /var/log/php5-fpm.log

; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice

; If this number of child processes exit with SIGSEGV or SIGBUS within
the time
; interval set by emergency_restart_interval then FPM will restart. A
value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0

; Interval of time used by emergency_restart_interval to determine when

; a graceful restart will be initiated.  This can be useful to work
around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0

; Time limit for child processes to wait for a reaction on signals from
master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0

; Send FPM to background. Set to 'no' to keep FPM in foreground for
debugging.
; Default Value: yes
;daemonize = yes
 
; Set open file descriptor rlimit for the master process.
; Default Value: system defined value
;rlimit_files = 1024
 
; Set max core size rlimit for the master process.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ; 
;;;;;;;;;;;;;;;;;;;;

; Multiple pools of child processes may be started with different
listening
; ports and different management options.  The name of the pool will be
; used in logs and stats. There is no limitation on the number of pools
which
; FPM can handle. Your system will tell you anyway :)

; To configure the pools it is recommended to have one .conf file per
; pool in the following directory:
include=/etc/php5/fpm/pool.d/*.conf



files is streaming via curl  
i dont have any idea 
and my logs are clean ( i don't see any probem)
i trayed debug mode but this isn't helpfull

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,220679,220679#msg-220679



More information about the nginx mailing list