Nginx - upload

Alexander Sobcanyuk sasa algosoft.ru
17 11:17:39 MSD 2011


 

     

   upload      nginx   
apache
(  ,    ,   FreeBSD 7.1 & 7.2)

1.   :

 sendfile on;
 keepalive_timeout 65;
 gzip on;

 server {
client_max_body_size 100m;

 root /*/htdocs;
 index index.php index.html index.htm;

 location / {
 try_files $uri @back;
  }

 location @back {
 proxy_pass http://192.168.0.1:8000;
 proxy_set_header X-Host $host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Request-Uri $request_uri;

 }
 }


       80Mb   
.
,    Chrome  ~20 ,   IE6-8,
Opera, FF     

ɚ  apache (ښ *:8000)   ~10  
 

2.    upload:


location /upload {
 # Pass altered request body to this location
 upload_pass @back;
# gzip off;
# client_body_in_file_only clean;
# client_body_temp_path /*/tmp;
# directio 4m;
# sendfile on;
# client_body_buffer_size 128k;
# upload_buffer_size 128k;
# keepalive_timeout 0;
# tcp_nopush on;
# tcp_nodelay on;

 # Store files to this location
 upload_store /*/tmp;

 # Set specified fields in request body
 upload_set_form_field $upload_field_name.name "$upload_file_name";
 upload_set_form_field $upload_field_name.content_type
"$upload_content_type";
 upload_set_form_field $upload_field_name.path "$upload_tmp_path";

 # Inform backend about hash and size of a file
 upload_aggregate_form_field "$upload_field_name.size"
"$upload_file_size";

 # Pass matching fields from client to backend
 upload_pass_form_field "^uarea|action|action2|id|do|sb$";
 upload_limit_rate 0;

 upload_cleanup 400-505;
 }

   Chrome  ~12-15 ,    
- .
 FF  Opera  -   ~1Mb/s   
  ~150kb/s. 
 ,       - ,  
     25Mb  40 
 IE6        ~150kb/s. 
  ~1Mb/s     2-3Mb/s    
40-50. 

ɚ  Ӛ  (win2000, XP, Vista, win2008server)
   .
  2-   ( , Ś 
FreeBSD  nginx)
 ךlocation /upload  ,    - 
    (.  ).  
    ,  ,     .

   :
CPU: 1.3% user, 0.0% nice, 2.3% system, 1.5% interrupt, 94.9% idle

 ,      apache  , 
     


    ?





nginx-ru