upload-using-x-progress-demo
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Demo app for upload using X-Progress headers
# Readme : Contents
1. What and Why 
2. Installation
3. Configuration
 * Nginx configuration in details
 * Possible other options of httpd configuration - Apache 2.*,
4. Problems
5. Summary  

# What && Why ?
 This is more proof-of-concept that X-Progress is good stuff  
## How the demo wroks ?

1. go to `http://uploaddemo.com/upload_progress/new`
2. select file and click upload
3. now you can point the name of file
4. look at the progression bar
5. You can now ( while uploading ) type name of the file in text box
6. after it loads, file path on server will be displayed with name ( name is sent to server when file is uploaded )
 
# Installation
  First of all you will need few things:
  
1. nginx (0.6.13 can be obtain from [http://nginx.net](http://nginx.net "nginx home"))
2. nginx-upload-progress-module (`git clone https://github.com/masterzen/nginx-upload-progress-module.git` to get source)
3. rvmsudo passenger-install-nginx-module ( if installing without rvm skip rvm)
4. choose option "2" point to nginx source and add module `--add-module=/path/to/nginx_uploadprogress_module/`
5. NomNomNom it is build for you... ready!   
6. add to your nginx http scope config 

    passenger_root /passenger-3.0.2;
    passenger_ruby /ruby;
    passenger_default_user nobody;
 

## testing the module
go to `nginx_upload_progress_module/test` and run `client.sh 1 http://uploaddemo.com/progress` should show you how it works. 

## Instalation of bundler, passenger  

1. install ruby
2. install rvm ( or not, your choice :8 )
3. install bundler `gem install bundler`
4. install passenger `gem install passenger` 
5. run `bundler install` in app dir
  
# Configuration 

## etc/hosts ;)

you don't have to but i tend to add new projects to /etc/hosts and add line `127.0.0.1 uploaddemo.com`

## nginx        

To configure it good you just need to add few things.

     http { 
       upload_progress proxied 1m;
       
This reserves upload_progress stash with 1 mb size. 
Rest is in our server config here is sample ( with passenger)

     server {
       listen 80;
       server_name uploaddemo.com;
       root /Users/kuba/Workspace/Ruby/upload_demo/public; #path to application point to public ofc :-F
       access_log /opt/nginx/logs/upload_demo_access.log;
       passenger_enabled on;
       rails_env development;     

      location ^~ /progress {
        # report uploads tracked in the 'proxied' zone 
        report_uploads proxied;
        track_uploads proxied 30s;
      }
     }

Most important part is location of /progress this will be our point of requests to check status of uploaded files.


## apache ( possible, not tested )

here is apache config, not tested ( time issues ;X )

    
       ServerName uploaddemo.com
       DocumentRoot "/Users/kuba/Workspace/Ruby/upload_demo/public"
       RailsEnv development
       RailsAllowModRewrite off

      
        Order allow,deny
        Allow from all
      


      # needed for tracking upload progess
      
        # enable tracking uploads in /
        TrackUploads On
      

      
        # enable upload progress reports in /progress
        ReportUploads On
      
    

# Problems
* it worked well on nginx 0.6.13 but after "smart" upgrade to 0.9.4 what was forced after update of passenger it stopped and returns only status `starting`. I forked module and I will look if i can fix it. 
* suggestion is to deploy to apache / lighthttpd ( RFC comes from lighty implementation so probably it should work ;) 

# Summary
It was fun to work with this technology, i enraged a bit with nginx 0.9.4 but rage is part of life ;))))

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。