PHP . SU
Программирование на PHP, MySQL и другие веб-технологии
Описание: гдето то кешит, но где не понятно
Поиск в теме | Версия для печати
duhon
Отправлено: 20 Октября, 2014 - 13:43:13
Гость
Покинул форум
Сообщений всего: 72
Дата рег-ции: Нояб. 2011
Помог: 5 раз(а)
в виртуалке поднял ubuntu 14, из пакетов nginx, php, php-fpm
все работает хорошо, с php
но со статикой что то непонятное.
создаю index.html, пишу туда пару букв, запрашиваю этот файл через браузер, все хорошо.
меняю файл, опять запрашиваю его через браузер (в хроме отключил кеширование) получаю старые (необновленные) данные.
я отчетливо вижу что http статус 200 что значит что это не кеш браузера.
подозреваю что nginx гдето что то закешировал.
еще заметил такой прикол.
текст 1111111111 в браузере 1111111111
изменил текст на 1111111111222 в браузере 1111111111���
изменил текст на 2222 в браузере 1111
(тоесть механизм который кеширует. знает что тект уже поменялся, но всреавно выводит старые данные)
Помогите разобраться где ошибка, почему кешиться данные.
З.Ы. если не nginx то кто еще может такое делать? настройка php-fpm дефолтная
nginx.conf
Спойлер (Отобразить )
user www-data;
worker_processes 1;
worker_rlimit_nofile 8192;
pid /run/nginx.pid;
events {
worker_connections 8000;
# multi_accept on;
}
http {
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
charset utf-8;
# Set the mime-types via the mime.types external file
include mime.types;
# And the fallback mime-type
default_type application/octet-stream;
# Hide nginx version
server_tokens off;
# ~2 seconds is often enough for HTML/CSS, but connections in
# Nginx are cheap, so generally it's safe to increase it
keepalive_timeout 20;
# You usually want to serve static files with Nginx
sendfile on;
tcp_nopush on; # off may be better for Comet/long-poll stuff
tcp_nodelay off; # on may be better for Comet/long-poll stuff
server_name_in_redirect off;
types_hash_max_size 2048;
upstream php {
server unix:/var/run/php5-fpm.sock;
}
gzip on;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_min_length 512;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types
# text/html is always compressed by HttpGzipModule
text/css
text/plain
text/x-component
application/javascript
application/json
application/xml
application/xhtml+xml
application/x-font-ttf
application/x-font-opentype
application/vnd.ms-fontobject
image/svg+xml
image/x-icon;
# This should be turned on if you are going to have pre-compressed copies (.gz) of
# static files available. If not it should be left off as it will cause extra I/O
# for the check. It would be better to enable this in a location {} block for
# a specific directory:
# gzip_static on;
gzip_disable "msie6";
gzip_vary on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
chat
Спойлер (Отобразить ) server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/chat.loc/html;
index index.php index.html index.htm;
server_name chat.loc;
location / {
try_files $uri $uri/ /index.php;
}
location ~ \.php$ {
# With php5-fpm:
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
include fastcgi_params;
}
location ~ /\. {
deny all;
}
}
debug nginx
Спойлер (Отобразить ) 2014/10/20 11:59:23 [debug] 2082#0: epoll add event: fd:6 op:1 ev:00000001
2014/10/20 11:59:23 [debug] 2082#0: epoll add event: fd:7 op:1 ev:00000001
2014/10/20 11:59:31 [debug] 2082#0: accept on 0.0.0.0:80, ready: 0
2014/10/20 11:59:31 [debug] 2082#0: posix_memalign: 0000000000EAF4E0:256 @16
2014/10/20 11:59:31 [debug] 2082#0: *1 accept: 192.168.2.1 fd:3
2014/10/20 11:59:31 [debug] 2082#0: *1 event timer add: 3: 60000:1413806431310
2014/10/20 11:59:31 [debug] 2082#0: *1 reusable connection: 1
2014/10/20 11:59:31 [debug] 2082#0: *1 epoll add event: fd:3 op:1 ev:80000001
2014/10/20 11:59:31 [debug] 2082#0: accept on 0.0.0.0:80, ready: 0
2014/10/20 11:59:31 [debug] 2082#0: posix_memalign: 0000000000EDC160:256 @16
2014/10/20 11:59:31 [debug] 2082#0: *2 accept: 192.168.2.1 fd:10
2014/10/20 11:59:31 [debug] 2082#0: *2 event timer add: 10: 60000:1413806431310
2014/10/20 11:59:31 [debug] 2082#0: *2 reusable connection: 1
2014/10/20 11:59:31 [debug] 2082#0: *2 epoll add event: fd:10 op:1 ev:80000001
2014/10/20 11:59:31 [debug] 2082#0: *1 http wait request handler
2014/10/20 11:59:31 [debug] 2082#0: *1 posix_memalign: 0000000000EDC270:256 @16
2014/10/20 11:59:31 [debug] 2082#0: *1 malloc: 0000000000EBCF50:1024
2014/10/20 11:59:31 [debug] 2082#0: *1 recv: fd:3 430 of 1024
2014/10/20 11:59:31 [debug] 2082#0: *1 reusable connection: 0
2014/10/20 11:59:31 [debug] 2082#0: *1 posix_memalign: 0000000000EBD360:4096 @16
2014/10/20 11:59:31 [debug] 2082#0: *1 http process request line
2014/10/20 11:59:31 [debug] 2082#0: *1 http request line: "GET /test.html HTTP/1.1"
2014/10/20 11:59:31 [debug] 2082#0: *1 http uri: "/test.html"
2014/10/20 11:59:31 [debug] 2082#0: *1 http args: ""
2014/10/20 11:59:31 [debug] 2082#0: *1 http exten: "html"
2014/10/20 11:59:31 [debug] 2082#0: *1 posix_memalign: 0000000000EB3A20:4096 @16
2014/10/20 11:59:31 [debug] 2082#0: *1 http process request header line
2014/10/20 11:59:31 [debug] 2082#0: *1 http header: "Host: chat.loc"
2014/10/20 11:59:31 [debug] 2082#0: *1 http header: "Connection: keep-alive"
2014/10/20 11:59:31 [debug] 2082#0: *1 http header: "Pragma: no-cache"
2014/10/20 11:59:31 [debug] 2082#0: *1 http header: "Cache-Control: no-cache"
2014/10/20 11:59:31 [debug] 2082#0: *1 http header: "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
2014/10/20 11:59:31 [debug] 2082#0: *1 http header: "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/37.0.2062.120 Chrome/37.0.2062.120 Safari/537.36"
2014/10/20 11:59:31 [debug] 2082#0: *1 http header: "Accept-Encoding: gzip,deflate,sdch"
2014/10/20 11:59:31 [debug] 2082#0: *1 http header: "Accept-Language: ru-RU,ru;q=0.8,en;q=0.6,uk;q=0.4"
2014/10/20 11:59:31 [debug] 2082#0: *1 http header done
2014/10/20 11:59:31 [debug] 2082#0: *1 event timer del: 3: 1413806431310
2014/10/20 11:59:31 [debug] 2082#0: *1 generic phase: 0
2014/10/20 11:59:31 [debug] 2082#0: *1 rewrite phase: 1
2014/10/20 11:59:31 [debug] 2082#0: *1 test location: "/"
2014/10/20 11:59:31 [debug] 2082#0: *1 test location: ~ "\.php$"
2014/10/20 11:59:31 [debug] 2082#0: *1 test location: ~ "/\."
2014/10/20 11:59:31 [debug] 2082#0: *1 using configuration "/"
2014/10/20 11:59:31 [debug] 2082#0: *1 http cl:-1 max:1048576
2014/10/20 11:59:31 [debug] 2082#0: *1 rewrite phase: 3
2014/10/20 11:59:31 [debug] 2082#0: *1 post rewrite phase: 4
2014/10/20 11:59:31 [debug] 2082#0: *1 generic phase: 5
2014/10/20 11:59:31 [debug] 2082#0: *1 generic phase: 6
2014/10/20 11:59:31 [debug] 2082#0: *1 generic phase: 6
2014/10/20 11:59:31 [debug] 2082#0: *1 generic phase: 7
2014/10/20 11:59:31 [debug] 2082#0: *1 access phase: 8
2014/10/20 11:59:31 [debug] 2082#0: *1 access phase: 9
2014/10/20 11:59:31 [debug] 2082#0: *1 post access phase: 10
2014/10/20 11:59:31 [debug] 2082#0: *1 try files phase: 11
2014/10/20 11:59:31 [debug] 2082#0: *1 http script var: "/test.html"
2014/10/20 11:59:31 [debug] 2082#0: *1 trying to use file: "/test.html" "/var/www/chat.loc/html/test.html"
2014/10/20 11:59:31 [debug] 2082#0: *1 try file uri: "/test.html"
2014/10/20 11:59:31 [debug] 2082#0: *1 content phase: 12
2014/10/20 11:59:31 [debug] 2082#0: *1 content phase: 13
2014/10/20 11:59:31 [debug] 2082#0: *1 content phase: 14
2014/10/20 11:59:31 [debug] 2082#0: *1 content phase: 15
2014/10/20 11:59:31 [debug] 2082#0: *1 content phase: 16
2014/10/20 11:59:31 [debug] 2082#0: *1 http filename: "/var/www/chat.loc/html/test.html"
2014/10/20 11:59:31 [debug] 2082#0: *1 add cleanup: 0000000000EBE080
2014/10/20 11:59:31 [debug] 2082#0: *1 http static fd: 11
2014/10/20 11:59:31 [debug] 2082#0: *1 http set discard body
2014/10/20 11:59:31 [debug] 2082#0: *1 xslt filter header
2014/10/20 11:59:31 [debug] 2082#0: *1 charset: "" > "utf-8"
2014/10/20 11:59:31 [debug] 2082#0: *1 HTTP/1.1 200 OK^M
Server: nginx^M
Date: Mon, 20 Oct 2014 11:59:31 GMT^M
Content-Type: text/html; charset=utf-8^M
Content-Length: 11^M
Last-Modified: Mon, 20 Oct 2014 11:58:29 GMT^M
Connection: keep-alive^M
ETag: "5444f8e5-b"^M
Accept-Ranges: bytes^M
2014/10/20 11:59:31 [debug] 2082#0: *1 write new buf t:1 f:0 0000000000EBE258, pos 0000000000EBE258, size: 243 file: 0, size: 0
2014/10/20 11:59:31 [debug] 2082#0: *1 http write filter: l:0 f:0 s:243
2014/10/20 11:59:31 [debug] 2082#0: *1 http output filter "/test.html?"
2014/10/20 11:59:31 [debug] 2082#0: *1 http copy filter: "/test.html?"
2014/10/20 11:59:31 [debug] 2082#0: *1 image filter
2014/10/20 11:59:31 [debug] 2082#0: *1 xslt filter body
2014/10/20 11:59:31 [debug] 2082#0: *1 http postpone filter "/test.html?" 00007FFFB80795F0
2014/10/20 11:59:31 [debug] 2082#0: *1 write old buf t:1 f:0 0000000000EBE258, pos 0000000000EBE258, size: 243 file: 0, size: 0
2014/10/20 11:59:31 [debug] 2082#0: *1 write new buf t:0 f:1 0000000000000000, pos 0000000000000000, size: 0 file: 0, size: 11
2014/10/20 11:59:31 [debug] 2082#0: *1 http write filter: l:1 f:0 s:254
2014/10/20 11:59:31 [debug] 2082#0: *1 http write filter limit 0
2014/10/20 11:59:31 [debug] 2082#0: *1 tcp_nopush
2014/10/20 11:59:31 [debug] 2082#0: *1 writev: 243
2014/10/20 11:59:31 [debug] 2082#0: *1 sendfile: @0 11
2014/10/20 11:59:31 [debug] 2082#0: *1 sendfile: 11, @0 11:11
2014/10/20 11:59:31 [debug] 2082#0: *1 http write filter 0000000000000000
2014/10/20 11:59:31 [debug] 2082#0: *1 http copy filter: 0 "/test.html?"
2014/10/20 11:59:31 [debug] 2082#0: *1 http finalize request: 0, "/test.html?" a:1, c:1
2014/10/20 11:59:31 [debug] 2082#0: *1 set http keepalive handler
2014/10/20 11:59:31 [debug] 2082#0: *1 http close request
2014/10/20 11:59:31 [debug] 2082#0: *1 http log handler
2014/10/20 11:59:31 [debug] 2082#0: *1 run cleanup: 0000000000EBE080
2014/10/20 11:59:31 [debug] 2082#0: *1 file cleanup: fd:11
2014/10/20 11:59:31 [debug] 2082#0: *1 free: 0000000000EBD360, unused: 3
2014/10/20 11:59:31 [debug] 2082#0: *1 free: 0000000000EB3A20, unused: 2713
2014/10/20 11:59:31 [debug] 2082#0: *1 free: 0000000000EBCF50
2014/10/20 11:59:31 [debug] 2082#0: *1 hc free: 0000000000000000 0
2014/10/20 11:59:31 [debug] 2082#0: *1 hc busy: 0000000000000000 0
2014/10/20 11:59:31 [debug] 2082#0: *1 reusable connection: 1
2014/10/20 11:59:31 [debug] 2082#0: *1 event timer add: 3: 20000:1413806391316
2014/10/20 11:59:31 [debug] 2082#0: *1 post event 00007F1219FDB148
2014/10/20 11:59:31 [debug] 2082#0: *1 delete posted event 00007F1219FDB148
2014/10/20 11:59:31 [debug] 2082#0: *1 http keepalive handler
2014/10/20 11:59:31 [debug] 2082#0: *1 malloc: 0000000000EBCF50:1024
2014/10/20 11:59:31 [debug] 2082#0: *1 recv: fd:3 -1 of 1024
2014/10/20 11:59:31 [debug] 2082#0: *1 recv() not ready (11: Resource temporarily unavailable)
2014/10/20 11:59:31 [debug] 2082#0: *1 free: 0000000000EBCF50
2014/10/20 11:59:41 [debug] 2082#0: *2 http wait request handler
2014/10/20 11:59:41 [debug] 2082#0: *2 posix_memalign: 0000000000EDC380:256 @16
2014/10/20 11:59:41 [debug] 2082#0: *2 malloc: 0000000000EBCF50:1024
2014/10/20 11:59:41 [debug] 2082#0: *2 recv: fd:10 0 of 1024
2014/10/20 11:59:41 [info] 2082#0: *2 client closed connection while waiting for request, client: 192.168.2.1, server: 0.0.0.0:80
2014/10/20 11:59:41 [debug] 2082#0: *2 close http connection: 10
2014/10/20 11:59:41 [debug] 2082#0: *2 event timer del: 10: 1413806431310
2014/10/20 11:59:41 [debug] 2082#0: *2 reusable connection: 0
2014/10/20 11:59:41 [debug] 2082#0: *2 free: 0000000000EBCF50
2014/10/20 11:59:41 [debug] 2082#0: *2 free: 0000000000EDC160, unused: 0
2014/10/20 11:59:41 [debug] 2082#0: *2 free: 0000000000EDC380, unused: 128
2014/10/20 11:59:51 [debug] 2082#0: *1 event timer del: 3: 1413806391316
2014/10/20 11:59:51 [debug] 2082#0: *1 http keepalive handler
2014/10/20 11:59:51 [debug] 2082#0: *1 close http connection: 3
2014/10/20 11:59:51 [debug] 2082#0: *1 reusable connection: 0
2014/10/20 11:59:51 [debug] 2082#0: *1 free: 0000000000000000
2014/10/20 11:59:51 [debug] 2082#0: *1 free: 0000000000EAF4E0, unused: 0
2014/10/20 11:59:51 [debug] 2082#0: *1 free: 0000000000EDC270, unused: 128
(Отредактировано автором: 20 Октября, 2014 - 15:05:06)
duhon
Отправлено: 20 Октября, 2014 - 17:23:55
Гость
Покинул форум
Сообщений всего: 72
Дата рег-ции: Нояб. 2011
Помог: 5 раз(а)
ну проблема описанная в сылке почти полностью другая. У него пустота вместо статики, и он вообще хочет ее кешировать. Я же сейчас не хочу ничего кэшить, и как минимум разобраться почему так, ведь нигде неописано что должно что то кэшироваться.
кстате header Last-Modified возращает правильную информацию о дате изменения.
пример ответа
Спойлер (Отобразить ) HTTP/1.1 200 OK
Server: nginx
Date: Mon, 20 Oct 2014 14:18:12 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 4
Last-Modified: Mon, 20 Oct 2014 14:14:42 GMT
Connection: keep-alive
ETag: "544518d2-4"
Accept-Ranges: bytes
З.Ы. я попробывал варианты описаные там, резльтата нету. (я рестартовал nginx)
duhon
Отправлено: 21 Октября, 2014 - 10:24:27
Гость
Покинул форум
Сообщений всего: 72
Дата рег-ции: Нояб. 2011
Помог: 5 раз(а)
root@vagrant:/home/vagrant# cat /var/www/chat.loc/html/test.html
33333333333333333333333333
но при запросе из браузера выдает одинички
tcpdump -i eth1 -A -nn port 80
Спойлер (Отобразить ) 07:20:13.351493 IP 192.168.2.1.40017 > 192.168.2.2.80: Flags [S], seq 3863696041, win 29200, options [mss 1460,sackOK,TS val 469211 ecr 0,nop,wscale 7], length 0
E..<zr@.@.:..........Q.P.KR.......r.R#.........
..(.........
07:20:13.351533 IP 192.168.2.2.80 > 192.168.2.1.40017: Flags [S.], seq 1131483148, ack 3863696042, win 28960, options [mss 1460,sackOK,TS val 440904 ecr 469211,nop,wscale 7], length 0
E..<..@.@..h.........P.QCq...KR...q ...........
...H..(.....
07:20:13.351620 IP 192.168.2.1.40017 > 192.168.2.2.80: Flags [.], ack 1, win 229, options [nop,nop,TS val 469211 ecr 440904], length 0
E..4zs@.@.:..........Q.P.KR.Cq.
.....=.....
..(....H
07:20:13.351846 IP 192.168.2.1.40017 > 192.168.2.2.80: Flags [P.], seq 1:459, ack 1, win 229, options [nop,nop,TS val 469211 ecr 440904], length 458
E...zt@.@.92.........Q.P.KR.Cq.
....'E.....
..(....HGET /test.html HTTP/1.1
Host: chat.loc
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:33.0) Gecko/20100101 Firefox/33.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: ggChatAccountId=41bdf06213
Connection: keep-alive
If-Modified-Since: Tue, 21 Oct 2014 07:01:27 GMT
If-None-Match: "544604c7-18"
Cache-Control: max-age=0
07:20:13.351860 IP 192.168.2.2.80 > 192.168.2.1.40017: Flags [.], ack 459, win 235, options [nop,nop,TS val 440904 ecr 469211], length 0
E..4.E@.@..+.........P.QCq.
.KTt.....z.....
...H..(.
07:20:13.353806 IP 192.168.2.2.80 > 192.168.2.1.40017: Flags [P.], seq 1:271, ack 459, win 235, options [nop,nop,TS val 440904 ecr 469211], length 270
E..B.F@.@.
..........P.QCq.
.KTt...........
...H..(.HTTP/1.1 200 OK
Server: nginx
Date: Tue, 21 Oct 2014 07:20:13 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 26
Last-Modified: Tue, 21 Oct 2014 07:19:34 GMT
Connection: keep-alive
ETag: "54460906-1a"
Accept-Ranges: bytes
11111111111111111111111111
07:20:13.353899 IP 192.168.2.1.40017 > 192.168.2.2.80: Flags [.], ack 271, win 237, options [nop,nop,TS val 469212 ecr 440904], length 0
E..4zu@.@.:..........Q.P.KTtCq.......\.....
..(....H
07:20:23.356506 IP 192.168.2.1.40017 > 192.168.2.2.80: Flags [.], ack 271, win 237, options [nop,nop,TS val 471712 ecr 440904], length 0
E..4zv@.@.:..........Q.P.KTsCq.............
..2....H
07:20:23.356545 IP 192.168.2.2.80 > 192.168.2.1.40017: Flags [.], ack 459, win 235, options [nop,nop,TS val 443405 ecr 469212], length 0
E..4.G@.@..).........P.QCq...KTt.....z.....
...
..(.
07:20:33.373541 IP 192.168.2.2.80 > 192.168.2.1.40017: Flags [F.], seq 271, ack 459, win 235, options [nop,nop,TS val 445909 ecr 469212], length 0
E..4.H@.@..(.........P.QCq...KTt.....z.....
......(.
07:20:33.373961 IP 192.168.2.1.40017 > 192.168.2.2.80: Flags [F.], seq 459, ack 272, win 237, options [nop,nop,TS val 474215 ecr 445909], length 0
E..4zw@.@.:..........Q.P.KTtCq.......B.....
..<g....
07:20:33.373990 IP 192.168.2.2.80 > 192.168.2.1.40017: Flags [.], ack 460, win 235, options [nop,nop,TS val 445909 ecr 474215], length 0
E..4.I@.@..'.........P.QCq...KTu.....z.....
......<g
Поиск в теме | Версия для печати
Страниц (1): [1]
Сейчас эту тему просматривают: 0 (гостей: 0, зарегистрированных: 0)
« Apache и другие веб-серверы »
Все гости форума могут просматривать этот раздел. Только зарегистрированные пользователи могут создавать новые темы в этом разделе. Только зарегистрированные пользователи могут отвечать на сообщения в этом разделе.
Powered by ExBB FM 1.0 RC1. InvisionExBB