nginx proxy config problem

21andy nginx-forum at nginx.us
Thu May 24 09:26:52 UTC 2012


2 question:
1. i want to put the pic,css,js etc. files on the frontend server, but
with below config, i put a tar file to /var/www/a.com/test.tar and
visite http://a.com/test.tar it return a 404 herder. how can i fix it?

2. i want control the proxy cache for different cache time with the
different request uri, could you give me the right way to config it ?
thank you very much.

my nginx.conf

server {
    listen 80;
    root  /var/www/a.com;
    server_name a.com;
    index index.html index.htm index.php;

    location ^~ /admin/ {
        proxy_pass http://backend;
    }

    location ~* ^/post/ {
        proxy_cache             main;
        proxy_cache_valid       200 301 302 60d;
        proxy_cache_valid       any 30d;
        proxy_pass              http://backend;
    }

    location ~* ^/(list|archive)/ {
        proxy_cache             main;
        proxy_cache_valid       200 301 302 60d;
        proxy_cache_valid       any 1d;
        proxy_pass              http://backend;
    }

    location ~ ^.*\.php$ {
        proxy_pass http://backend;
    }

    location / {
        proxy_cache             main;
        proxy_cache_valid       any 10m;
        proxy_pass http://backend;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$ {
        expires      30d;
    }

}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,226787,226787#msg-226787



More information about the nginx mailing list