Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Nginx сжирает всю память при кэшировании
- To: nginx-ru@xxxxxxxxx
- Subject: Nginx сжирает всю память при кэшировании
- From: "X-Thief" <nginx-forum@xxxxxxxx>
- Date: Sun, 25 Mar 2012 17:59:32 -0400 (EDT)
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tigger.jlkhosting.com; s=x; h=From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To:Date; bh=Pod0S4KMMpVHKjHVG7sW6RSK9h623Ca966o+AzxJ0Lk=; b=kVYKPDUiNojL6ezmtkskWaEv1BpUiFoTeLMLv2Nrejzh+HqonKvWXPag58bRMhaXBR/n0YAOU01Hr5WHi93FuAs0irIWrAdkqq6291uZAbRsZVd+Vh+Kg0uAUVhs9wp2;
Имеется сервер с 1гб ОЗУ, при включенном
кэшировании жрет до 900мб памяти, что
плохо влияет на работу сайта
Уж очень нужно это кэшировании для
гостей сайта, т.к. конкуренты бывает
поддосят иногда.
Как уменьшить количество сжираемой
оперативки? Или это так и нужно?
Собственно конфиг:
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
http {
include /etc/nginx/mime.types;
proxy_cache_path /var/cache/nginx levels=2 keys_zone=pagecache:15m
inactive=30s max_size=500m;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
include /usr/local/ispmgr/etc/nginx.domain;
client_max_body_size 2M;
log_format isp '$bytes_sent $request_length';
server {
server_name domen.ru www.domen.ru;
listen domen.ru;
proxy_temp_path /var/cache/nginx/domen.ru;
location @nocached {
proxy_pass http://domen:81;
proxy_redirect http://domen: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|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$
{
expires 1m;
root /var/www/domen/data/www/domen.ru;
access_log /var/www/nginx-logs/domen isp;
access_log /var/www/httpd-logs/domen.ru.access.log ;
error_page 404 = @fallback;
}
location / {
proxy_pass http://domen:81;
proxy_redirect http://domen:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
if ($cookie_КУКА) { return 412; }
if ($request_method = POST ) {
return 412;
}
error_page 412 = @nocached;
proxy_cache pagecache;
proxy_cache_key
"$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Cache-Control" "Expires";
proxy_cache_valid 200 302 304 30s;
proxy_cache_valid 301 5m;
proxy_cache_valid 503 4s;
proxy_cache_valid any 1m;
proxy_cache_use_stale http_502 http_503 http_504;
}
location ~ (login.php) {
proxy_pass http://domen:81;
proxy_redirect http://domen: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 ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass http://domen:81;
proxy_redirect http://domen:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass http://domen:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
include /usr/local/ispmgr/etc/nginx.inc;
}
}
Posted at Nginx Forum:
http://forum.nginx.org/read.php?21,224364,224364#msg-224364
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru
|