I have a request: http://www.example.com/app?test=1
. I hope to cache this when there is the request parameter test=1
url
. Can nginx
do it? .
I write
in the configuration fileservice {
location /app {
if ( $arg_test ) {
//nginx 的 cache 的配置
}
}
}
But an error is reported when starting. Tells me cache
cannot be configured in an if
block. . .
First of all, of course you cannot put
全部
configuration in ifBut you can do this
This answer may not meet your requirements, but is it really necessary to conditionalize the cache configuration?
Posting a more detailed configuration file may help you understand your needs better...
Welcome to follow my segmentfault blog.