Drupal upload progress

Drupal filefield provide a upload progress bar when you uploding files. You should install APC upload progress module or PECL uploadprogress module.

PHP 5.2+ should be updated if you use APC as the upload progress system. The detailed instruction you can find at IBM’s guide.

PECL uplaod progress module can be find at http://pecl.php.net/package/uploadprogress/

Or install just a command line: pecl install uploadprogress.  Then Add extension=uploadprogress.so to php.ini, restart your Apache Server. This module is suggested.

All these modules must install with Apache Server.

Nginx upload progress Module

Nginx also provide the upload progress system. If this module are enabled, all upload files will be cached in Nginx before the whole file is uploaded.

Nginx buffers the entire upload before passing it to the php backend. So if you chose Nginx as the HTTP server or Proxy at the front of Apache Server, the Drupal upload progress will not work!

But the Nginx upload system is so brilliant that it will reduce the stress to the PHP backend, so your Server will be more stable and fast.

How to use Nginx upload progress module with Drupal uploading progress bar:

1. APC progress or PECL progress module are NOT required, because we use Nginx upload progress moudle.

2. You should install filefield_nginx_progress module in Drupal

3. You should compile Nginx with HttpUploadProgressModule

./configure –add-module=/www/nginx_uploadprogress_module

4. Configure in php.ini with upload file size limit and post size limit.

post_max_size = 2000M

upload_max_filesize = 2000M

5. Sample Nginx configuration file:

Apache as the back end server at port 81, Nginx as the proxy at port 80. Your domain name is www1.dev

http {
    client_max_body_size 2000M;
    client_body_buffer_size 128k;

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

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    upload_progress uploads 1m;

    #gzip  on;

    server {
        listen       80;
        server_name  www1.dev;

	location ~ (.*)/x-progress-id:(\w*) {
            rewrite ^(.*)/x-progress-id:(\w*)  $1?X-Progress-ID=$2;
        }

        location ^~ /progress {
            report_uploads uploads;
        }

	location / {
	   proxy_set_header    X-Real-IP  $remote_addr;
	   proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
	   proxy_set_header    Host $http_host;

	   proxy_pass          http://127.0.0.1:81;
	   proxy_redirect      default;
	   add_header        X-Test Proxied;  # for diagnosis only - can be removed

	   track_uploads uploads 60s;
	}

	# serve static files directly
	location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
	   root /www/docs/www1.dev/drupal-6.x-dev;
	   access_log        off;
           expires           30d;
           add_header        X-Test Direct;  # for diagnosis only - can be removed
	}
    }
}

Drupal nginx progress module: http://drupal.org/project/filefield_nginx_progress

Nginx upload progress module: https://github.com/masterzen/nginx-upload-progress-module

Instruction about Drupal nginx uploading progress module:

http://drupalcode.org/viewvc/drupal/contributions/modules/filefield_nginx_progress/README.txt?view=co&pathrev=DRUPAL-6–1

推荐这些相关文章

订阅这个博客:

关注我的微博:

关注我的推特: