Здравствуйте, господа. Установлена связка nginx + php-fpm. При обращении к статичному контенту (html, jpg и т.д.) заголовок Last-Modified возвращается нормально, но не воспринимается If-Modified-Since. Если же обращаюсь к динамичному контенту (php), то Last-Modified не возвращается и не воспринимается If-Modified-Since. Подскажите, пожалуйста, каким образом можно заставить nginx возвращать заголовок Last-Modified для php и воспринимать If-Modified-Since? В качестве средства проверки использую сайт http://last-modified.com/ru/if-modified-since.html.
Вот мой конфиг nginx:
user www-data www-data;
worker_processes 2;
worker_cpu_affinity 0101 1010;
worker_rlimit_nofile 8192;
worker_priority -5;
timer_resolution 100ms;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
multi_accept on;
accept_mutex on;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
index index.html index.htm index.php;
upstream example.com {
server unix:/var/run/php5-fpm_example.com.sock max_fails=3 fail_timeout=3s;
}
server {
listen *:80;
server_name example.com;
root /home/example.com/www;
access_log /var/log/nginx/access.log;
location ~ ^.+\.php(?:/.*)?$ {
fastcgi_pass example.com;
include fastcgi_params;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if ($uri ~ ^(?<script_name>.+\.php)?(?<path_info>/.*)?$) {}
set $path_info_final $path_info;
if ($fastcgi_path_info != '') {
set $path_info_final $fastcgi_path_info;
}
fastcgi_param PATH_INFO $path_info_final;
set $script_name_final '/index.php';
if ($script_name != '') {
set $script_name_final $script_name;
}
fastcgi_param SCRIPT_FILENAME $document_root$script_name_final;
if (!-e $document_root$script_name_final) {
return 404;
}
fastcgi_param SCRIPT_NAME $script_name_final;
set $request_uri_final $request_uri;
if ($path_info_final != '') {
set $request_uri_final $path_info_final$is_args$args;
}
fastcgi_param REQUEST_URI $request_uri_final;
fastcgi_index index.php;
fastcgi_next_upstream error timeout;
fastcgi_keep_conn on;
fastcgi_hide_header "X-Powered-By";
}
location / {
index index.html index.htm index.php;
try_files $uri $uri/ /index.html /index.htm /index.php;
}
location /blog {
try_files $uri $uri/ /blog/index.php?q=$uri&$args;
}
location ~ \.(htc|js|js2|js3|js4)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
}
location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
expires 3600s;
add_header Pragma "public";
add_header Cache-Control "max-age=3600, public, must-revalidate, proxy-revalidate";
}
location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
}
}
}