Welcome! Log In Create A New Profile

Advanced

Проблема с кэшированием статики/картинок.

June 09, 2010 03:12PM
####
OS: FreeBSD 7.2
NGINX: 0.7.66
####
>cat nginx.conf
user www;
worker_processes 2;
error_log /var/log/nginx_log.err;
pid /var/run/nginx.pid;
timer_resolution 150ms;
worker_rlimit_nofile 81920;
events {
worker_connections 64000;
use kqueue;
}

http {
include 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_log.acc;

sendfile on;
tcp_nopush on;
keepalive_timeout 0;
client_max_body_size 20M;

gzip on;
gzip_types text/plain text/css application/x-javascript text/xml application/xml;
gzip_buffers 4 8k;
gzip_comp_level 9;
gzip_static on;
gzip_proxied any;

tcp_nodelay on;
reset_timedout_connection on;
server_tokens off;

proxy_cache_path /tmp/nginx levels= keys_zone=mediacache:100m inactive=7d max_size=1g;
proxy_temp_path /tmp/nginx/tmp;

server {
listen 11.22.33.44:60080;
server_name ~^(.*)$;

set $p $host;
if ($host ~ www\.(.*)){ set $p $1; }

location / {
proxy_pass http://127.0.0.1:80;
proxy_redirect off;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|js|swf|doc|xls|mp3|mid|wma|pdf|ppsx|ttf|xml|txt|tpl)$ {
proxy_cache mediacache;
root /var/www/$p/html;
add_header Cache-Control public;
expires 7d;
}
}
###
>ls -l /tmp |grep nginx
drwxr-xr-x 3 www wheel 512 Jun 9 17:22 nginx
>ls -l /tmp/nginx
drwx------ 2 www wheel 512 Jun 9 17:20 tmp
###

Сайт прекрасно открывается. Но кэширование не происходит. Если я правильно понимаю, должны появляться файлы кэша в /tmp/nginx. Но они не создаются.
Subject Author Posted

Проблема с кэшированием статики/картинок.

Alec June 09, 2010 03:12PM

Re: Проблема с кэшированием статики/картинок.

squirl June 10, 2010 01:32AM

Re: Проблема с кэшированием статики/картинок.

Alec June 10, 2010 03:10AM

Re: Проблема с кэшированием статики/картинок.

squirl June 10, 2010 03:16AM

Re: Проблема с кэшированием статики/картинок.

Alec June 10, 2010 04:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 94
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready