Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help to set up Nginx caching
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
PritiPatel
n00b
n00b


Joined: 17 Feb 2017
Posts: 1

PostPosted: Fri Feb 17, 2017 10:08 am    Post subject: Help to set up Nginx caching Reply with quote

Hello!

I am trying to setting up NGINX caching on the server for the DLE website. Like all finally it happened, but now there is a problem with which I cannot cope. Hope someone could help in fixing this.

I need to add an exception for the rule, recently added to the news site (so that they are not cached). URLs have the structure: http://site.com/99999-service-page.html, to add to the exclusion of all the news in which more than 9,999 id (ie, contains 5 digits).

That itself config:

Code:
server {
server_name site.com www.site.com;
listen xxx.xxx.xxx.xxx;
set $root_path /var/www/site/data/www/site.com;
proxy_temp_path /var/cache/nginx/site.com;
location @nocached {
proxy_pass http://xxx.xxx.xxx.xxx:81;
proxy_redirect http://xxx.xxx.xxx.xxx:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
proxy_pass http://xxx.xxx.xxx.xxx:81;
proxy_redirect http://xxx.xxx.xxx.xxx:81 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
if ($cookie_dle_user_id) { return 412; }
if ($cookie_dle_password) { return 412; }
if ($request_method = POST ) {
return 412;
}
error_page 412 = @nocached;
proxy_cache one;
proxy_cache_key "$request_method|$is_args|$host|$request_uri";
#proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Cache-Control" "Expires" "Set-Cookie";
proxy_cache_valid 200 302 304 2m;
proxy_cache_valid 301 1h;
proxy_cache_valid 503 4s;
proxy_cache_valid any 1m;
proxy_cache_use_stale http_502 http_503 http_504;
}
location ~ (admin.php|index.php?action=logout) {
proxy_pass http://xxx.xxx.xxx.xxx:81;
proxy_redirect http://xxx.xxx.xxx.xxx:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ {
root /var/www/site/data/www/site.com;
expires 1y;
error_page 404 = @fallback;
}
location @fallback {
proxy_pass http://xxx.xxx.xxx.xxx:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
include /usr/local/ispmgr/etc/nginx.inc;
charset CP1251;


I try to change this, here's the line:

Code:
location ~ (admin.php|index.php?action=logout) { 

location ~ (admin.php | index.php action = logout |? [0-9] { 5}) {

location ~ (admin.php | index.php action = logout |? [0-9] { 5}) {

location The ~ (?.. admin.php | the index.php the action = the logout | [0-9] {5} - * \ html) {


I tried to add the following lines to my code:

Code:
location The ~ * [0-9] {5 {}
error_page 412 = @fallback;
412 return;
}


But nothing changes (in terms of cache), or the server refuses to start = (

Help me to understand where I am going wrong? How to add/ to make this exception?
_________________
Priti Patel
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum