Awesome q2a theme

nginx and multiple scripts

0 like 0 dislike
Good afternoon.
Installed nginx as frontend for apache.

I have some folder and in it three of the script that needs caching (they have a lot of sql - queries — and information is updated rarely).

How to write the nginx configuration?

Now here

server {
listen 80;
server_name ___ ___;

location / {
proxy_pass ___:8080;
proxy_cache off;

location /same folder/ {
expires 1d;
access_log off;
proxy_cache itmorating;
proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$request_uri";
proxy_pass __:8080;
proxy_temp_path /data/www/;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 10s;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $Host;

In this case, the problem is that /script.php and /script.php?123123123 two different pages and cached twice, so that the attacker can easily overwhelm the cache.
by | 20 views

1 Answer

0 like 0 dislike
proxy_cache_key "$request_method|$http_if_modified_since|$http_if_none_match|$request_uri"; < — see here, with the same success playing with these headers does the same thing, so it is necessary to cache not the entire request URI, and only the script name ($request_filename).

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 10, 2019 by hazratgs
110,608 questions
257,187 answers
40,796 users