perusio / drupal-with-nginx

Running Drupal using nginx: an idiosyncratically crafted bleeding edge configuration.
854 stars 246 forks source link

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

Open haggag opened 10 years ago

haggag commented 10 years ago

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.

elderone commented 9 years ago

+1

elderone commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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

Pronco commented 8 years ago

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

perusio commented 8 years ago

@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.

Pronco commented 8 years ago

@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