drupal-with-nginx
drupal-with-nginx copied to clipboard
Unable to use the statistics module with the new option " Use Ajax to increment the counter"
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.
+1
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
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; }
yes, i did /sites/mysite.com/modules/statistics/statistics.php too
It works, However it sometimes returns 502 bad gateway and doesn't count at all.
@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 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