

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in ru.sysoev.nginxRe: Can't make nginx to cache| From | Sent On | Attachments |
|---|---|---|
| Mirosław Jaworski | Jul 21, 2009 8:03 am | |
| Gabriel Ramuglia | Jul 21, 2009 12:29 pm | |
| Mirosław Jaworski | Jul 23, 2009 5:51 am | |
| Maxim Dounin | Jul 23, 2009 6:15 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Can't make nginx to cache | Actions... |
|---|---|---|
| From: | Gabriel Ramuglia (ga...@vtunnel.com) | |
| Date: | Jul 21, 2009 12:29:12 pm | |
| List: | ru.sysoev.nginx | |
Edit your php script to send caching headers
"X-Powered-By: PHP/5.2.6-2ubuntu4.2"
PHP by default does not send headers that would cause a browser or cache to decide that a result was cachable. This makes sense, as php is a dynamic language and the same url could return something dramatically different every time.
2009/7/21 Mirosław Jaworski <mj...@ikp.pl>:
Hi
Hello for the first time.
Intended config: nginx as caching reverse proxy.
nginx version: 0.7.61
Direct connect to backend:
$ telnet 192.168.10.18 80 Trying 192.168.10.18... Connected to 192.168.10.18. Escape character is '^]'. GET / HTTP/1.1 Host: www.xyz.pl
HTTP/1.1 200 OK Date: Tue, 21 Jul 2009 13:06:01 GMT Server: Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4.2 with Suhosin-Patch X-Powered-By: PHP/5.2.6-2ubuntu4.2 Vary: Accept-Encoding Content-Length: 22 Content-Type: text/html
ksjdhfksjdhfksjaghfksa Connection closed by foreign host.
Connect to fronted ( nginx ):
$ telnet A.B.C.D 80 Trying A.B.C.D... Connected to A.B.C.D. Escape character is '^]'. GET / HTTP/1.1 Host: www.xyz.pl
HTTP/1.1 200 OK Server: nginx Date: Tue, 21 Jul 2009 13:06:56 GMT Content-Type: text/html Connection: keep-alive X-Powered-By: PHP/5.2.6-2ubuntu4.2 Vary: Accept-Encoding Content-Length: 22
ksjdhfksjdhfksjaghfksa
nginx config:
---------------------------------------------------------------------- worker_processes 4;
events { worker_connections 2048; }
http { include mime.types; default_type application/octet-stream;
server_tokens off;
client_body_temp_path /opt/nginx/client_temp 1 2; proxy_temp_path /opt/nginx/proxy_temp 1 2; fastcgi_temp_path /opt/nginx/fastcgi_temp 1 2;
proxy_cache_path /opt/nginx/cache/A.B.C.D levels=1:2 keys_zone=one:10m;
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"';
sendfile on;
keepalive_timeout 65; server { listen A.B.C.D; server_name localhost; access_log /var/log/nginx/A.B.C.D.access.log main; location / { proxy_pass http://192.168.10.18:80/; proxy_redirect off;
proxy_cache one;
proxy_pass_header Set-Cookie;
proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
}
----------------------------------------------------------------------
I don't see anything preventing caching, but cache ( path given by proxy_cache_path ) remains empty :|
$ ls -al /opt/nginx/cache/A.B.C.D total 4 drwxr-xr-x 2 www www 512 Jul 21 12:13 . drwxr-xr-x 9 www www 512 Jul 21 12:13 ..
Should i do something more?
Regards
MJ
-- Mirosław "Psyborg" Jaworski GCS/IT d- s+:+ a C++$ UBI++++$ P+++$ L- E--- W++(+++)$ N++ o+ K- w-- O- M- V- PS+ PE++ Y+ PGP t 5? X+ R++ !tv b++(+++) DI++ D+ G e* h++ r+++ y? "Voltaire: It is dangerous to be right when the government is wrong."







