July 20, 2012 01:47PM
can you elaborate on how to implement it? For me, it seems to cache html as well (I'm checking saved files). Here's what I come up with:

nginx.conf

user nginx;
worker_processes 8;
worker_rlimit_nofile 100000;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
http {
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"';
access_log /var/log/nginx/access.log combined;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
gzip on;
gzip_static on;
gzip_comp_level 5;
gzip_min_length 1024;
keepalive_timeout 65;
limit_conn_zone $binary_remote_addr zone=addr:10m;
map $http_content_type $no_proxy {
default 0;
"~*image/" 1;
}
proxy_cache_path /tmp/nginx/cache/image levels=1:1:2 keys_zone=image:1000m;
proxy_temp_path /tmp/nginx/temp;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/vhosts/*;
}


vhost:

server {
listen 8082;
server_name .forum.domain.com;
charset utf-8;
access_log /var/log/nginx/forum.domain.com-access.log2 combined;
error_log /var/log/nginx/forum.domain.com-error.log2;
location / {
root /var/www/html/forum.domain.com;
index index.php;
try_files $uri @apache;
}
location /forum {
root /var/www/html/forum.domain.com;
index index.php;
try_files $uri @apache;
}
location /gallery {
root /var/www/html/forum.domain.com;
index index.php;
try_files $uri @apache;
}
location ~ ^.*\.php$ {
proxy_pass http://127.0.0.1:8081;
include proxy.cache.inc;
}
location @apache {
proxy_pass http://127.0.0.1:8081;
include proxy.cache.inc;
}
}


proxy.cache.inc:

proxy_cache image;
proxy_cache_use_stale updating;
proxy_cache_valid 7d;
proxy_cache_bypass $no_proxy;
proxy_connect_timeout 59s;
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_pass_header Set-Cookie;
proxy_redirect off;
proxy_hide_header Vary;
proxy_set_header Accept-Encoding '';
proxy_ignore_headers Cache-Control Expires;
proxy_set_header Referer $http_referer;
proxy_set_header Host $host;
proxy_set_header Cookie $http_cookie;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Subject Author Posted

Cache by mime type

burn July 20, 2012 09:57AM

Re: Cache by mime type

Denis F. Latypoff July 20, 2012 10:04AM

Re: Cache by mime type

burn July 20, 2012 01:47PM

Re: Cache by mime type

Valentin V. Bartenev July 20, 2012 02:00PM

Re: Cache by mime type

burn July 20, 2012 02:23PM

Re: Cache by mime type

Valentin V. Bartenev July 20, 2012 02:32PM

Re: Cache by mime type

burn July 20, 2012 02:45PM

Re: Cache by mime type

Valentin V. Bartenev July 20, 2012 02:52PM

Re: Cache by mime type

burn July 20, 2012 03:05PM

Re: Cache by mime type

Francis Daly July 22, 2012 04:10AM

Re: Cache by mime type

burn July 22, 2012 05:27AM

Re: Cache by mime type

Francis Daly July 22, 2012 02:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 304
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready