Using module: https://drupal.org/project/filefield_nginx_progress on a clean Drupal 7.26 Followed all instructions from the main page

Recompiled nginx 1.4.4 with http://wiki.nginx.org/HttpUploadProgressModule nginx -V shows the module

Now when i try to upload a file it just hangs on "Starting upload..." then i get the error:

An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (200 MB) that this server supports.

Though file is just 5mb

In watchdog i am getting the error:

page not found
http://domain.com/progress

Comments

RedRat’s picture

It seems that your nginx doesn't process /progress location. Look at log file for /process URL or post here part of nginx config related to /progress location.

Kristina Katalinic’s picture

I am having the exact same issue. @Heihachi88 perhaps you found a solution that you can share with us?
@RedRat Here is my vhost configuration:

        client_max_body_size 20M; ## <-- I put this here for larger photo uploads.
        index index.php index.html index.htm;
        #don't send the nginx version number in error pages and Server header
        server_tokens off;

        # config to don't allow the browser to render the page inside an frame or iframe
        # and avoid clickjacking http://en.wikipedia.org/wiki/Clickjacking
        # if you need to allow [i]frames, you can use SAMEORIGIN or even set an uri with ALLOW-FROM uri
        # https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
        add_header X-Frame-Options SAMEORIGIN;

        # when serving user-supplied content, include a X-Content-Type-Options: nosniff header along with the Content-Type: header,
        # to disable content-type sniffing on some browsers.
        # https://www.owasp.org/index.php/List_of_useful_HTTP_headers
        # currently suppoorted in IE > 8 http://blogs.msdn.com/b/ie/archive/2008/09/02/ie8-security-part-vi-beta-2-update.aspx
        # http://msdn.microsoft.com/en-us/library/ie/gg622941(v=vs.85).aspx
        # 'soon' on Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=471020
        add_header X-Content-Type-Options nosniff;
        #proxy_hide_header X-Powered-By; ## <-- I put this here
        # Enable compression, this will help if you have for instance advagg‎ module
        # by serving Gzip versions of the files.
        gzip_static on;


        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
        }

        # This matters if you use drush prior to 5.x
        # After 5.x backups are stored outside the Drupal install.
        #location = /backup {
        #        deny all;
        #}

        # Very rarely should these ever be accessed outside of your lan
        location ~* \.(txt|log)$ {
                allow 192.168.0.0/16;
                deny all;
        }

        location ~ \..*/.*\.php$ {
                return 403;
        }

        # No no for private
        location ~ ^/sites/.*/private/ {
                return 403;
        }
       # Block access to "hidden" files and directories whose names begin with a
        # period. This includes directories used by version control systems such
        # as Subversion or Git to store control files.
        location ~ (^|/)\. {
                return 403;
        }

        location / {
                # This is cool because no php is touched for static content
                try_files $uri @rewrite;
        }

        location @rewrite {
                # You have 2 options here
                # For D7 and above:
                # Clean URLs are handled in drupal_environment_initialize().
                rewrite ^ /index.php;
                # For Drupal 6 and bwlow:
                # Some modules enforce no slash (/) at the end of the URL
                # Else this rewrite block wouldn't be needed (GlobalRedirect)
                #rewrite ^/(.*)$ /index.php?q=$1;
        }
        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                fastcgi_intercept_errors on;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                track_uploads uploads 60s;
        }

       ## The Nginx module wants ?X-Progress-ID query parameter so
        ## that it report the progress of the upload through a GET
        ## request. But the drupal form element makes use of clean
        ## URLs in the POST.
        location ~ (?<upload_form_uri>.*)/x-progress-id:(?<upload_id>\d*) {
           rewrite ^ $upload_form_uri?X-Progress-ID=$upload_id;
        }

        ## Now the above rewrite must be matched by a location that
        ## activates it and references the above defined upload
        ## tracking zone.
        location ^~ /progress {
           upload_progress_json_output;
           report_uploads uploads;
        }
       ###
        ### CDN Far Future expiration support.
        ###
        location ^~ /cdn/farfuture/ {
                 tcp_nodelay   off;
                 access_log    off;
                 log_not_found off;
                 etag          off;
                 gzip_http_version 1.0;
                 if_modified_since exact;
                 location ~* ^/cdn/farfuture/.+\.(?:css|js|jpe?g|gif|png|ico|bmp|svg|swf|pdf|docx?|xlsx?|pptx?|tiff?|txt|rtf|class|otf|ttf|woff|eot|less)$ {
                 expires max;
                # add_header X-Header "CDN Far Future Generator 1.0";
                 add_header Cache-Control "no-transform, public";
                 add_header Last-Modified "Wed, 20 Jan 1988 04:20:42 GMT";
                 rewrite ^/cdn/farfuture/[^/]+/[^/]+/(.+)$ /$1 break;
                 try_files $uri @nobots;
         }
                 location ~* ^/cdn/farfuture/ {
                 expires epoch;
                # add_header X-Header "CDN Far Future Generator 1.1";
                 add_header Cache-Control "private, must-revalidate, proxy-revalidate";
                 rewrite ^/cdn/farfuture/[^/]+/[^/]+/(.+)$ /$1 break;
                 try_files $uri @nobots;
        }
                 try_files $uri @nobots;
        }

        # Fighting with Styles? This little gem is amazing.
        # This is for D6
        #location ~ ^/sites/.*/files/imagecache/ {
        # This is for D7 and D8
        location ~ ^/sites/.*/files/styles/ {
                try_files $uri @rewrite;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires max;
                log_not_found off;
        }
}

Additionally my nginx.conf file contains a zone for uploads as instructed in module readme file
upload_progress uploads 1m;

I installed the nginx upload progress module using nginx-extras install so I am not sure if the only thing that keeps coming up in nginx error.log Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:77
Has anything to do with the issue at hand.

Access.log displays following:

54.206.70.90 - - [06/Sep/2014:00:33:05 +1000] "GET /progress HTTP/1.0" 200 67 "-" "Drupal (+http://drupal.org/)"
144.137.134.64 - - [06/Sep/2014:00:33:05 +1000] "GET /filefield_nginx_progress/692310983 HTTP/1.1" 200 89 "http://mysite.com/node/add/article" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36"
54.206.70.90 - - [06/Sep/2014:00:33:07 +1000] "GET /progress HTTP/1.0" 200 67 "-" "Drupal (+http://drupal.org/)"
144.137.134.64 - - [06/Sep/2014:00:33:07 +1000] "GET /filefield_nginx_progress/692310983 HTTP/1.1" 200 89 "http://mysite.com/node/add/article" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36"
144.137.134.64 - - [06/Sep/2014:00:33:08 +1000] "POST /file/ajax/field_image/und/0/form-4CnNlA45jVW6tB3eAp5DbiD4QQHHSylDaodc_GNqf_Q/x-progress-id%3A692310983 HTTP/1.1" 200 388 "http://mysite.com/node/add/article" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36"

Hopefully this will help resolve the issue. If you need anything else just let me know.
And thanks for looking into it :)
Kristina

Kristina Katalinic’s picture

Status: Active » Closed (works as designed)

Hi,
This is in fact an issue with our nginx configuration and not this module. Since last reporting this issue I changed my nginx configuration to use https://github.com/perusio/drupal-with-nginx and filefield_nginx_progress is working like a charm so I am going to mark this as fixed (works as designed) so its not distracting the contributors from issues that are in fact related to this module and not our own poor nginx configurations.

MustangGB’s picture

Thought I was having a similar issue to this, turns out the issue I was having was #1220826: Not working when multiple values is allowed for file field.

However it was compounded because when I was manually visiting http://www.example.com/progress it responding with 404 Not Found so I thought it was an Nginx config issue, however for future reference https://www.example.com/progress?X-Progress-ID=1 does return json as expected.