Welcome! Log In Create A New Profile

Advanced

Nginx cache Problem :(

Posted by gruponarede 
Nginx cache Problem :(
August 09, 2012 11:53AM
I have on my dedicated server, nginx cache purge with 100% working for just a single domain.

now I want to put 100% purge cache to another domain, I've done everything else does not work.

nginx.conf
[code]
user nobody;
# no need for more workers in the proxy mode
worker_processes 2;
error_log /var/log/nginx/error.log info;
worker_rlimit_nofile 90480;
events {
worker_connections 35120; # increase for busier servers
use epoll; # you should use epoll here for Linux kernels 2.6.x
}
http {
server_name_in_redirect off;
server_names_hash_max_size 10240;
server_names_hash_bucket_size 1024;
include mime.types;
default_type application/octet-stream;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 5;
gzip on;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
gzip_proxied any;
gzip_http_version 1.1;
gzip_min_length 1000;
gzip_comp_level 6;
gzip_buffers 16 8k;
# You can remove image/png image/x-icon image/gif image/jpeg if you have slow CPU
gzip_types text/plain text/xml text/css application/x-javascript application/xml image/png image/x-icon image/gif image/jpeg application/xml+rss text/javascript application/atom+xml;
ignore_invalid_headers on;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
reset_timedout_connection on;
connection_pool_size 256;
client_header_buffer_size 256k;
large_client_header_buffers 4 256k;
client_max_body_size 200M;
client_body_buffer_size 128k;
request_pool_size 32k;
output_buffers 4 32k;
postpone_output 1460;
proxy_temp_path /tmp/nginx_proxy/;
client_body_in_file_only on;
log_format bytes_log "$msec $bytes_sent .";
proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=proxy_cache1:4m max_size=1024m inactive=365d;
include "/etc/nginx/vhosts/*";
}
[/code]

my domain 1 work purge cache
[code]
server {
error_log /var/log/nginx/vhost-error_log warn;
listen my_server_ip:80;
server_name mydomain1.com www.mydomain1.com my_server_ip;
access_log /usr/local/apache/domlogs/mydomain1.com-bytes_log bytes_log;
access_log /usr/local/apache/domlogs/mydomain1.com combined;
root /home/mydomain1/public_html;
location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
expires 7d;
try_files $uri @backend;
}
error_page 405 = @backend;
add_header X-Cache "HIT from Backend";
proxy_pass http://my_server_ip:8081;
include cache.inc;
include proxy.inc;
}
location @backend {
internal;
proxy_pass http://my_server_ip:8081;
include cache.inc;
include proxy.inc;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://my_server_ip:8081;
include cache.inc;
include proxy.inc;
}
location /notcached {
add_header X-Cache "HIT from Backend";
proxy_pass http://my_server_ip:8081;
include proxy.inc;
}
location ~ /\.ht {
deny all;
}
}
[/code]

domain 2 not work purge cache
[code]
server {
error_log /var/log/nginx/vhost-error_log warn;
listen my_server_ip:80;
server_name mydomain2.com www.mydomain2.com my_server_ip;
access_log /usr/local/apache/domlogs/mydomain2.com-bytes_log bytes_log;
access_log /usr/local/apache/domlogs/mydomain2.com combined;
root /home/mydomain2/public_html;
location / {
location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
expires 7d;
try_files $uri @backend;
}
error_page 405 = @backend;
add_header X-Cache "HIT from Backend";
proxy_pass http://my_server_ip:8081;
include cache.inc;
include proxy.inc;
}
location @backend {
internal;
proxy_pass http://my_server_ip:8081;
include cache.inc;
include proxy.inc;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://my_server_ip:8081;
include cache.inc;
include proxy.inc;
}
location /notcached {
add_header X-Cache "HIT from Backend";
proxy_pass http://my_server_ip:8081;
include proxy.inc;
}
location ~ /\.ht {
deny all;
}
}

[/code]

cache.inc
[code]
proxy_ignore_headers Set-Cookie Cache-Control Expires;
proxy_cache proxy_cache1;
proxy_cache_key "@$host@$request_uri";
proxy_cache_use_stale updating error timeout invalid_header http_502 http_503 http_504;
proxy_cache_min_uses 1;
proxy_ignore_client_abort off;
proxy_cache_valid 200 365d;
proxy_redirect off;
[/code]

Does this missing some permissions or chmod?
Could someone help me?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 99
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready