nginx and multiple scripts


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
8 views
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 | 8 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).
by

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,186 answers
0 comments
38,662 users