Welcome! Log In Create A New Profile

Advanced

nginx and proxy_cache_valid

Posted by damaska 
nginx and proxy_cache_valid
November 25, 2010 04:48PM
Hello, I'm using this nginx config file (see below). Now in proxy.inc I have proxy_cache_valid any 1m; .. and that's okay.

But for one domain (for example www.domain123.com) I want to set proxy_cache_valid any 60d;
How I can do it?
Thanks.



[i]worker_processes 2;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;
sendfile on;
ignore_invalid_headers on;

proxy_buffering on;

proxy_cache_path /nginx/cached levels=2:2 keys_zone=global:32m inactive=30m max_size=3G;
proxy_temp_path /nginx/nginx_proxy/;

keepalive_timeout 65;

client_body_in_file_only on;
client_max_body_size 100M;
client_body_buffer_size 128k;

server {
listen XX.XX.XX.XX:8888 default rcvbuf=8192 sndbuf=16384 backlog=32000;
charset off;

proxy_set_header Host $host;

location / {

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header REQUEST_METHOD $request_method;
proxy_set_header REMOTE_USER $remote_user;
proxy_set_header SERVER_PORT 80;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header HTTP_COOKIE $http_cookie;
proxy_set_header Referer $http_referer;

try_files $uri @backend;

location ~* \.(jpeg|jpg|gif|png|bmp|ico|js|css|swf)$ {
proxy_pass http://XX.XX.XX.XX;
include proxy.inc;
include cache.inc;
}
}

location @backend {
internal;
proxy_pass http://XX.XX.XX.XX;
include proxy.inc;
}

location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://XX.XX.XX.XX;
include proxy.inc;
}

}
}[/i]
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 256
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