Emerg]: "proxy_cache_path" directive is not allowed here in /usr/local/nginx-0.7.60/conf/nginx.conf:

Hi
Nginx version:0.7.60
Nginx compiling option:
./configure --prefix=/usr/local/nginx-0.7.60
Nginx conf:

  server {
    listen       8080;
    server_name  test.example.com;
    charset utf-8;

    access_log  logs/test.example.com-access.log  main;

    proxy_cache_path /tmp/cache levels=1:2 keys_zone=one:10m;
    location / {
        index  index.php index.html index.htm;
        proxy_pass http://static;
      proxy_set_header    Host $host;
        proxy_set_header    X-Forwarded-For 

$proxy_add_x_forwarded_for;
proxy_cache one;
proxy_cache_valid 200 30d;
proxy_cache_valid any 1h;
}
}
When run /usr/local/nginx-0.7.60/sbin/nginx
it showed:
emerg]: “proxy_cache_path” directive is not allowed here in
/usr/local/nginx-0.7.60/conf/nginx.conf:35

what is wrong?

On Thu, Jun 18, 2009 at 01:46:18PM +0800, XUFENG wrote:

        proxy_cache_valid any 1h;
    }
 }

When run /usr/local/nginx-0.7.60/sbin/nginx
it showed:
emerg]: “proxy_cache_path” directive is not allowed here in /usr/local/nginx-0.7.60/conf/nginx.conf:35

what is wrong?

proxy_cache_path can be set on http {} level only.

http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache_path
it has
“” context: http, server, location “”?


XUFENG
2009-06-18


发件人:Igor S.
发送日期:2009-06-18 14:11:35
收件人:nginx
抄送:
主题:Re: emerg]: “proxy_cache_path” directive is not allowed here in
/usr/local/nginx-0.7.60/conf/nginx.conf:35

On Thu, Jun 18, 2009 at 01:46:18PM +0800, XUFENG wrote:

        proxy_cache_valid any 1h;
    }
 }

When run /usr/local/nginx-0.7.60/sbin/nginx
it showed:
emerg]: “proxy_cache_path” directive is not allowed here in /usr/local/nginx-0.7.60/conf/nginx.conf:35

what is wrong?

proxy_cache_path can be set on http {} level only.


Igor S.
http://sysoev.ru/en/

Hello!

On Thu, Jun 18, 2009 at 02:42:29PM +0800, XUFENG wrote:

Module ngx_http_proxy_module
it has
“” context: http, server, location “”?

No, it has “context: http”. See

http://sysoev.ru/nginx/docs/http/ngx_http_proxy_module.html#proxy_cache_path

(in Russian).

Feel free to fix wiki.

Maxim D.