shared memory zone "media" conflicts with already declared size 0

Tomasz Pajor nikon at puffy.pl
Mon Sep 28 20:15:50 MSD 2009


what seems to be the problem?

[emerg]: the size 52428800 of shared memory zone "media" conflicts with 
already declared size 0 in /etc/nginx/conf.d/cache.conf:5
configuration file /etc/nginx/nginx.conf test failed

my configuration below

# nginx.conf
user nobody nogroup;
worker_processes 5;
error_log /var/log/nginx/error.log;
pid /var/run/nginx/nginx.pid;
worker_rlimit_nofile 8192;

events {
    use epoll;
    worker_connections  4096;
}

http {
    include base/std;
    include base/log_format;
    include base/gzip;
    include base/proxy_conf_real_ip;

    include /etc/nginx/conf.d/*.conf;
}

# base/std
include base/mime.types;
default_type application/octet-stream;

sendfile on;

tcp_nopush on;
tcp_nodelay off;

# base/log_format
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status  $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

# base/gzip
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml 
application/xml application/xml+rss text/javascript;

# base/proxy_conf_real_ip
include base/proxy_conf
proxy_set_header X-Real-IP $http_x_real_ip;

# base/proxy_conf
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;

# conf.d/cache.conf
client_body_temp_path /mnt/client_temp;
proxy_temp_path /mnt/proxy_temp;
fastcgi_temp_path /mnt/fastcgi_temp;

proxy_cache_path /mnt/media levels=1:2 keys_zone=media:50m max_size=5000m;

server {
    listen 80;

    location / {
        proxy_pass http://media.server:8080;
        include extra/cache;
    }
}

# conf.d/ssl.conf
server {
    listen 443;

    ssl on;
    ssl_certificate ssl/ssl.crt;
    ssl_certificate_key ssl/ssl.key;

    ssl_session_timeout 5m;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

    location / {
        proxy_pass https://media.server:4430;
        include extra/cache;
    }
}

# extra/cache
proxy_cache media;
proxy_cache_key $request_uri;
proxy_cache_valid 200 28d;
proxy_cache_valid 404 1m;
proxy_cache_valid 500 2m;
proxy_cache_use_stale error timeout invalid_header http_500 http_502 
http_503 http_504;
proxy_ignore_headers Expires Cache-Control;
FileETag on;
expires max;





More information about the nginx mailing list