Answer the question
In order to leave comments, you need to log in
Nginx + php-fpm + nginx cache is growing $request_time for some reason?
There is nginx, nginx cache is used. Config:
user apache;
worker_processes 8;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 65536;
events {
use epoll;
multi_accept on;
worker_connections 2048;
}
http {
server_names_hash_max_size 512;
server_names_hash_bucket_size 64;
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $upstream_connect_time - $request_time [$upstream_response_time] $upstream_cache_status';
access_log off;
error_log /var/log/nginx/error.log crit;
keepalive_timeout 45;
client_max_body_size 128m;
client_body_timeout 35;
reset_timedout_connection on;
send_timeout 30;
proxy_max_temp_file_size 0;
fastcgi_max_temp_file_size 0;
sendfile on;
aio threads;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=FLASHGAMES:720m inactive=12h use_temp_path=off;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_lock off;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/vhosts/*/*.conf;
}
server {
server_name blabla.ru www.blabla.ru;
charset off;
index index.html index.php;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/blabla.ru/*.conf;
access_log /var/www/httpd-logs/blabla.ru.access.log;
error_log /var/www/httpd-logs/blabla.error.log notice;
ssi on;
set $root_path /var/www/user30/data/www/blabla.ru;
root $root_path;
listen 80;
set $skip_cache 0;
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
set $skip_cache 1;
}
# Don't cache URIs containing the following segments
if ($request_uri ~* "/wp-admin/|wp-login.php|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml|/sitemanage") {
set $skip_cache 1;
}
# Don't use the cache for logged-in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set $skip_cache 1;
}
location / {
try_files $uri $uri/ /index.php?$args;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}
gzip on;
gzip_comp_level 3;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
location ~* \.(jpg|jpeg|jpe|gif|png|css|bmp|js|ico|ogg|mp3|flv|swf|ttf|woff|woff2)$ {
expires max;
add_header Cache-Control "max-age=88000, public";
}
location = /robots.txt {
access_log off;
log_not_found off;
}
location = /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
}
location @php {
fastcgi_index index.php;
fastcgi_pass unix:/var/www/php-fpm/user30.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
include fastcgi_params;
fastcgi_cache FLASHGAMES;
fastcgi_cache_valid 200 12h;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
}
}
5.45.203.61 - - [02/Dec/2017:08:04:34 +0300] "GET / HTTP/1.1" 200 34158 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" "-" - - 0.054 [-] HIT
5.45.203.61 - - [02/Dec/2017:08:04:41 +0300] "GET / HTTP/1.1" 200 34158 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" "-" - - 0.054 [-] HIT
5.45.203.61 - - [02/Dec/2017:08:04:52 +0300] "GET / HTTP/1.1" 200 34158 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" "-" - - 0.102 [-] HIT
5.45.203.61 - - [02/Dec/2017:08:05:03 +0300] "GET / HTTP/1.1" 200 34158 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" "-" - - 0.298 [-] HIT
5.45.203.61 - - [02/Dec/2017:08:05:15 +0300] "GET / HTTP/1.1" 200 34158 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)" "-" - - 0.999 [-] HIT
2017/12/02 08:00:21 [warn] 1490#1490: could not build optimal server_names_hash, you should increase either server_names_hash_max_size: 512 or server_names_hash_bucket_size: 64; ignoring server_names_hash_bucket_size
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question