Nginx Issue

Cliff Wells cliff at develix.com
Fri Mar 5 21:29:05 MSK 2010


On Fri, 2010-03-05 at 11:13 -0500, gmk.jaga wrote:
> Hi,
> 
> I am facing memory leak problem with nginx in my servers.
> 
> The nginx is taking more cache memory while running continuously.


"cache memory"?   What command are you using to get this?

> 
> server {
> 
>     listen 80;
> 
>     client_max_body_size 50M;
> 
>     server_name www.sample.com;
> 
>     root /home/public;
> 
>     # access_log  /var/log/nginx.vhost.access.log  main;
>     send_timeout 20;
> 
>     location ~* ^.+\.(jpg|jpeg|JPG|JPEG|GIF|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|mov)$ {
>         root /home/public;
>         expires 7d;
> 
>         proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
>         proxy_set_header Host $http_host;
>         proxy_redirect off;
>         proxy_max_temp_file_size 0;
>         proxy_connect_timeout 30;
> 
>         if (!-f $request_filename) {
> 	  rewrite maintenance.html break;
>           proxy_pass http://Sample;
>         }
>     }

As an aside, it appears you could simplify your config a bit (and make
it more efficient as well):

server {
    listen 80; 
    client_max_body_size 50M;
    server_name www.sample.com;
    send_timeout 20;

    location / {
        root /home/public;
        expires 7d;

        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_max_temp_file_size 0;
        proxy_connect_timeout 30;

        try_files $uri $uri/ @backend;
    }

    location @backend {
        root /home/public;
        rewrite maintenance.html break;
        proxy_pass http://Sample;
    }
}

Regards,
Cliff




More information about the nginx mailing list