M
M
Mexof2014-09-02 16:46:49
PHP
Mexof, 2014-09-02 16:46:49

How to know that Nginx is caching dynamics?

Used Nginx+php-fpm. Site on Drupal. Set up Nginx to cache page dynamics. How to check if Nginx is using its own cache or using Drupal's cache? The page headers do not change, only the page load time during caching changes, for the better.
Confuses this header:
X-Drupal-Cache:HIT

Answer the question

In order to leave comments, you need to log in

4 answer(s)
C
coder4web, 2014-09-03
@Mexof

Set the log format for caching and watch with your favorite standard means)

http {
log_format  cache  '$remote_addr - $remote_user [$time_local] $request '
"$status" $body_bytes_sent "$http_referer" "$host" '
'"$http_user_agent" "$http_x_forwarded_for" "$upstream_cache_status" '
'"$upstream_addr" "$upstream_response_time" "$request_time"';
...
server {
access_log /var/log/nginx/access.log cache;
...
}
}

tail -f /var/log/nginx/access.log |grep -e '"HIT"'

I
Igor, 2014-09-02
@merryjane

Try to search manually in the directory with the cache:
where /nginx/proxy_cache_path is the directory with the cache specified in the nginx config,
your_links is the part of the url of the page that should have been cached.

_
_ _, 2014-09-02
@AMar4enko

You can disable php-fpm and try to pull the supposedly cached resource :D

D
Damir Makhmutov, 2014-09-02
@doodoo

Or you can look at the HTTP headers of the server response.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question