Hi There,

I am trying to get this module working with nginx but need a little assistance with the nginx.conf. Below is what I have so far and nginx loads ok, but I still cant seem to get the progress bar to show correctly.

Any tips on what I might have wrong in the code would be muchly appreciated.

Tks.

user  nobody;
# no need for more workers in the proxy mode
worker_processes  1;
error_log  /var/log/nginx/error.log info;
worker_rlimit_nofile 20480;
events {
 worker_connections 5120; # increase for busier servers
 use epoll; # you should use epoll here for Linux kernels 2.6.x
}
http {
 server_name_in_redirect off;
 server_names_hash_max_size 2048;
 server_names_hash_bucket_size 256;
 include    mime.types;
 default_type  application/octet-stream;
 server_tokens off;
 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 keepalive_timeout  60;
 gzip on;
 gzip_vary on;
 gzip_disable "MSIE [1-6]\.";
 gzip_proxied any;
 gzip_http_version 1.1;
 gzip_min_length  0;
 gzip_comp_level  6;
 gzip_buffers  16 8k;
# You can remove image/png image/x-icon image/gif image/jpeg if you have slow CPU
 gzip_types    text/plain text/xml text/css application/x-javascript application/xml image/png image/x-icon image/gif image/jpeg application/xml+rss text/javascript application/atom+xml;
 ignore_invalid_headers on;
 client_header_timeout  3m;
 client_body_timeout 3m;
 send_timeout     3m;
 reset_timedout_connection on;
 connection_pool_size  256;
 client_header_buffer_size 256k;
 large_client_header_buffers 4 256k;
 client_max_body_size 10M; 
 client_body_buffer_size 128k;
 upload_progress uploads 1m;
 request_pool_size  32k;
 output_buffers   4 32k;
 postpone_output  1460;
 proxy_temp_path  /tmp/nginx_proxy/;
 client_body_in_file_only on;
 log_format bytes_log "$msec $bytes_sent .";
 include "/etc/nginx/vhosts/*";
}

server {
    listen 80;
    server_name  site.com www.site.com;

    location ^~ /progress {
        report_uploads uploads;
    }   

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


    access_log /var/log/nginx/$host.access.log;
    error_log /var/log/nginx/error.log info;

    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_redirect default;
	track_uploads uploads 60s;
        proxy_pass          http://127.0.0.1:8080;
        add_header          X-Test Proxied;  # for diagnosis only - can be removed
	proxy_redirect default;
        track_uploads uploads 60s;
    

}

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

    # imagecache needs to process the 404 for missing images so it can create them
    location ^~ /files/imagecache/ {
        root /home/site/public_html;
        access_log        off;
        expires           30d;
        error_page 404 /;
    }
}

Comments

smoothify’s picture

Hello

After a quick glance at your configuration - I noticed a difference.

Yours:

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

Readme:

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

Here you are missing the asterisk after the periods. This means you are only matching a single character and therefore the rewrites won't work correctly.

virtuali1151’s picture

Hi Smoothify,

Thanks.. I have changed that.. and now upon trying to restart the service I am getting this error:

unknown directive "upload_progress" in /etc/nginx/nginx.conf:41

Any ideas?

Tks for your help mate.

Cheers.

smoothify’s picture

This sounds like you don't have a version of nginx compiled with MasterZens upload_progress module, this is required for this module to work.

http://github.com/masterzen/nginx-upload-progress-module/blob/master/README

Depending on what platform you are using, the instructions on how to install will differ.

virtuali1151’s picture

Hey Smoothify.. I got it compiled with it ok now, and there is no errors etc... Nginx is up and working and I have confirmed that the upload progress mod is enabled by running nginx -V and it shows me it in the config arguments now. I think it now just has to do with the nginx.conf file... it did give me an error originally that the proxy_pass had to be BEFORE the proxy_redirect default so I changed that.... and it works ok.. but still no progress bar..??

I think I am getting closer... just missing something small in the config I think.

Thanks again for any tips on anything I might be missing in the nginx.conf file?

Cheers.

perusio’s picture

The backend that you're proxying to must have the module installed. Enable the debug log: http://nginx.org/en/docs/debugging_log.html and see if the location that rewrites the URI is being used at all. I suspect there's some issues with the redirections on the backend.

szantog’s picture

Issue summary: View changes

Format code