Cannot totally switch off caching

Alexander Kunz akunz at wishmedia.de
Mon Jul 1 12:37:31 UTC 2013


Hi,

and don't forget database's cache. You write about PHP, often there is 
mysql also involved, which have the ability to cache.

Regards
Alexander


Am 01.07.2013 10:33, schrieb imanenkov:
> 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
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



More information about the nginx mailing list