upstream keepalive - call for testing

magicbear nginx-forum at nginx.us
Fri Aug 26 16:28:36 UTC 2011


I tried to disabled my script, but still cause a coredump.

here is my nginx.conf


user www-data;
worker_processes  4;

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

worker_rlimit_core  8000M;
working_directory   /var/www/ngx_coredump/;
debug_points abort;

worker_rlimit_nofile 131072;
events {
    worker_connections  16384;
	use epoll;
    # multi_accept on;
}

http {
	log_format logger
'$http_host||$remote_addr||$msec||$status||$request_length||$bytes_sent||"$request"||"$http_referer"||"$http_user_agent"||$upstream_cache_status||$upstream_status';
	
	
    include       /etc/nginx/mime.types;

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


    sendfile        on;
	
	# double size of page  (get : getconf PAGESIZE)
	client_header_buffer_size 64k;
	#open_file_cache max=150000 inactive=20s;
	#open_file_cache_valid 2s;
	#open_file_cache_min_uses 1;
	large_client_header_buffers 4 256k;
	
	client_max_body_size    100m;
	client_body_buffer_size 128k;
	proxy_temp_path /dev/shm/proxy_temp;
	proxy_connect_timeout 5s;
	proxy_send_timeout   10;
	proxy_read_timeout   10;
	proxy_buffer_size    4k;
	proxy_buffers     16 32k;
	proxy_busy_buffers_size 64k;
	proxy_temp_file_write_size 64k;
	proxy_ignore_client_abort on;
	
	fastcgi_connect_timeout 300;
	fastcgi_send_timeout 300;
	fastcgi_read_timeout 300;
	#first response buffer size
	fastcgi_buffer_size  256K;
	#continue response buffer size
	fastcgi_buffers      32 256K;
	#busy buffer
	fastcgi_busy_buffers_size 2048k;
	fastcgi_temp_file_write_size 2048k;
	
	index index.html index.htm index.php;

	#tcp_nopush: Sends the HTTP response headers in one packet.
    tcp_nopush		on;

    #keepalive_timeout  0;
    keepalive_timeout  5;
	# make it small for hard load server
	
	#tcp_nodelay: Disables the Nagle buffering algorithm. Well, that
cleared that one up!
	# General web use does require a response from the client , tune it to
off
    tcp_nodelay			off;

	server_tokens off;
	
    gzip  off;
    gzip_disable msie6;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}






=======================================================================================
sites-enabled/site.conf

proxy_cache_path /var/www/cdn_cache  levels=1:2  
keys_zone=cache_proxy:2048m max_size=4096m;

upstream backend {
	server 10.0.0.1 weight=3 fail_timeout=2s;
	keepalive 30;
}
limit_req_zone  $binary_remote_addr  zone=limit_cdn:32m   rate=10r/s;
server {
	listen 80;
	server_name 10.0.0.2;

	limit_req zone=limit_cdn burst=10;
	
	add_header X-Via "$hostname";
	add_header X-Debug "$server_addr";
	
	root /var/www/cdn;
	access_log /dev/shm/logger logger;
	
	error_log /var/log/nginx/ct.error;
	gzip on;
	gzip_buffers     4 16k;
	gzip_min_length  1k;
	gzip_http_version 1.1;
	gzip_comp_level 9;
	gzip_types text/plain application/x-javascript text/css
application/xml;
	gzip_vary on;
	gzip_proxied any;

	location ~ ^/purge(/.*) {
		proxy_cache_purge cache_proxy $1$is_args$args;
	}
	location ~ \.(swf)$
	{
		proxy_cache cache_proxy;
		proxy_cache_valid 200 304 1h;
		proxy_cache_key $uri;
		add_header X-Cache "$upstream_cache_status from $hostname";
		expires 600s;
		proxy_ssl_session_reuse on;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Connection "keep-alive";
		
		proxy_pass http://backend;
	}
	location ~ ^/images/(.+)
	{
		proxy_cache cache_proxy;
		proxy_cache_valid 200 304 8h;
		proxy_cache_key $uri;
		add_header X-Cache "$upstream_cache_status from $hostname";
		expires 1h;
		proxy_ssl_session_reuse on;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Connection "keep-alive";
		
		proxy_pass http://backend;
	}
	location ~ ^/sitemap/(.+)
	{
		proxy_cache cache_proxy;
		proxy_cache_valid 200 304 8h;
		proxy_cache_key $uri;
		add_header X-Cache "$upstream_cache_status from $hostname";
		expires 8h;
		proxy_ssl_session_reuse on;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Connection "keep-alive";
		
		proxy_pass http://backend;
	}
	location ~ ^/search
	{
		proxy_cache cache_proxy;
		proxy_cache_valid 200 304 600s;
		proxy_cache_key $uri$is_args$args;
		add_header X-Cache "$upstream_cache_status from $hostname";
		expires 600s;
		proxy_ssl_session_reuse on;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header Connection "keep-alive";
		
		proxy_pass http://backend;
	}
	location / {
		
		proxy_set_header X-Real-IP $remote_addr;
		add_header X-Cache "MISS from $hostname";
		proxy_set_header Connection "keep-alive";
		proxy_buffering off;	#Direct send to client
		proxy_ssl_session_reuse on;
		proxy_pass http://backend;
	}
	rewrite "^/$" /index.htm;
}

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



More information about the nginx mailing list