fastcgi_cache_path errors

whiskybar nginx-forum at nginx.us
Thu Sep 16 15:28:22 MSD 2010


Hello,

this is the first time I wanted to cache FastCGI responses from the
upstream servers. I have set up everything like in the documentation
examples but I got

[code]
Reloading nginx configuration: [emerg]: the size 10485760 of shared
memory zone "obrazek"
conflicts with already  declared size 0 in /etc/nginx/nginx.conf:41 
configuration file /etc/nginx/nginx.conf test failed
[/code]

on nginx reload. It does not say where the first occurence of this
memory zone is. I have grepped all my configs but this line 41 is the
only occurrence. I'm using nginx 0.8.50. I noticed there were some
directories /var/lib/nginx/fastcgi with the fastcgi_cache two level
structure already before I turned on this directive. I guessed there
were created by the Ubuntu package. I redirected the fastcgi_cache_path
to another location, yet to no avail.

[code]
user www-data;
worker_processes  4;

error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    log_format vcombined    '$host $remote_addr - $remote_user
[$time_local] '
                            '"$request" $status $body_bytes_sent '
                            '"$http_referer" "$http_user_agent"';
    access_log /var/log/nginx/access.log vcombined;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  65;
    tcp_nodelay        on;
    client_body_timeout 5;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

        fastcgi_cache_path /var/lib/nginx/fastcgi
                levels=1:2 
                keys_zone=obrazek:10m 
                inactive=5m;
}

upstream php {
        server unix:/var/run/php5-fpm.sock;
}

server {

        location / {
                root /var/www;
                index index.html index.php index.xhtml index.htm;
        }

        location /psat/obrazek.php {
                fastcgi_pass php;
                fastcgi_index   index.php;
                fastcgi_param   SCRIPT_FILENAME
/var/www$fastcgi_script_name;
                include fastcgi_params;
                
                fastcgi_cache obrazek;
                fastcgi_cache_valid any 10m;
                fastcgi_cache_use_stale error  timeout invalid_header
http_500;
        }
}
[/code]

fastcgi_param:

[code]
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
[/code]

Thank you
Jiri

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,130917,130917#msg-130917




More information about the nginx mailing list