drupal-with-nginx icon indicating copy to clipboard operation
drupal-with-nginx copied to clipboard

Unable to use the statistics module with the new option " ‏Use Ajax to increment the counter"

Open haggag opened this issue 10 years ago • 7 comments

The new feature performs the count asynchronously after page load rather than during page generation by sending a request to /modules/statistics/statistics.php.

I had to add the following to my site conf file to allow that to work.

location = /modules/statistics/statistics.php { fastcgi_pass phpcgi; }

Thanks.

haggag avatar Aug 23 '14 18:08 haggag

+1

elderone avatar Jan 28 '15 20:01 elderone

some.ip - - [28/Jan/2015:23:47:33 +0300] "GET /modules/statistics/statistics.php HTTP/1.1" 404 193 "http://some/url" "Mozilla/5.0 (Windows NT 6.3; WOW6 etc

elderone avatar Jan 28 '15 20:01 elderone

in site.conf: ## access to other modules .php files include apps/drupal/other_modules.conf;

/etc/nginx# cat apps/drupal/other_modules.conf location = /modules/statistics/statistics.php { fastcgi_pass phpcgi; }

elderone avatar Jan 28 '15 20:01 elderone

yes, i did /sites/mysite.com/modules/statistics/statistics.php too

elderone avatar Jan 28 '15 20:01 elderone

It works, However it sometimes returns 502 bad gateway and doesn't count at all.

Pronco avatar Oct 01 '15 13:10 Pronco

@Pronco what do you mean 502? This means the upstream is not properly setup. Paste or in a Gist your /sites/mysite.com/modules/statistics/statistics.php location.

perusio avatar Oct 08 '15 15:10 perusio

@perusio I've managed to get it work using the below:

Fix statistics module with Ajax to increment view counters

    location = /modules/statistics/statistics.php {
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_pass phpcgi;
    }

I think SCRIPT_FILENAME $request_filename works to process the count instead of SCRIPT_FILENAME $document_root/index.php

Pronco avatar Oct 10 '15 15:10 Pronco