Cannot totally switch off caching
imanenkov
nginx-forum at nginx.us
Mon Jul 1 08:33:55 UTC 2013
Greeting!
For some testing I need to switch off a nginx caching (nginx + php-fpm). Now
I have a trouble - when I request a server (PHP app) first time, response
generated about 10 sec (its ok), but when a request a server another time
(during approx 1-2 mins from first request) response is returned within
50-100 msec, as I understand from some cache.
I trying to get pages via wget and httperf.
My configurations:
I create a 2 config templates named default and php:
default:
index index.html index.php;
location /status {
stub_status on;
}
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
# Закрываем доступ к файлами .htaccess и .htpassword
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
php (initial variant):
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
host settings in sites-enabled:
server{
listen 80;
access_log /var/log/nginx/site.access_log;
error_log /var/log/nginx/site.error_log;
root /var/www/site;
include /etc/nginx/templates/default;
include /etc/nginx/templates/php;
}
Tests running:
httperf --server site.local --num-conns 1 --verbose >perf.log
First request - approx 10 sec
Second request approx 100 msec.
I trying to disable caching with:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_cache off;
fastcgi_no_cache 1;
fastcgi_cache_bypass 1;
expires off;
}
+restarting nginx и php-fpm, but this has no effect.
Please help.
Best regards,
Ilya
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,240433,240433#msg-240433
More information about the nginx
mailing list