Answer the question
In order to leave comments, you need to log in
What is the correct way to write such a location rule?
There is a Symfony project running on NGINX and Fast-CGI. To reduce the load, it was decided to enable the cache via fastcgi_cache
At the moment, everything is cached by the mask *.php by the rule
location ~ \.php$ {
...
fastcgi_pass_header "Set-Cookie";
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_cache_key "$server_addr:$server_port$request_uri|$cookie_phpsessid|$cookie_symfony|$cookie_OAID";
fastcgi_cache fastcgi_cache;
fastcgi_temp_path /var/cache/nginx/ 1 2;
fastcgi_cache_use_stale updating error timeout invalid_header http_500;
fastcgi_cache_valid 120s;
}
but because of this, the admin panel is also cached, which causes certain inconveniences when working with it.
As far as I know, for a certain location, you can disable caching by writing a rule. The essence of the question is how to write a rule correctly if the admin panel locations look like:
in a private form? /backend.php/sfCompany/9223/edit
in general /backend.php/(.*)
Answer the question
In order to leave comments, you need to log in
Most likely like this:
location = /backend.php {
...
}
location ~ ^/backend\.php.+$ {
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question