请教, nginx 出错, nginx: [emerg] the size 10485760 of shared memory zone "limit" conflicts with already declared size

2018-04-07 17:29:32 +08:00
 kmdd33

服务器:centos7,openresty,php7

配置按照的教程: https://segmentfault.com/a/1190000011299586

在执行命令:

/usr/local/openresty/nginx/sbin/nginx -t

出现了错误:

nginx: [emerg] the size 10485760 of shared memory zone "limit" conflicts with already declared size 52428800 in /usr/local/openresty/nginx/conf/nginx.conf:38 nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed

请问如何 fix 这个错误?为什么会出现这个错误?在哪里修改?具体需要修改成什么样子(请直接贴答案)?请教小伙伴们,谢谢。

我执行的命令:

vim /usr/local/openresty/nginx/conf/nginx.conf

/usr/local/openresty/nginx/sbin/nginx -t

贴出目前自己的 nginx.conf:

user www; worker_processes 1;

#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;

#pid logs/nginx.pid;

events { worker_connections 1024; }

http { include mime.types; default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;

#tcp_nopush on;

#WAF

lua_shared_dict limit 50m; #防 cc 使用字典,大小 50M

lua_shared_dict guard_dict 100m;

lua_shared_dict dict_captcha 70m;

lua_max_running_timers 1;

lua_package_path "/usr/local/openresty/nginx/conf/waf/?.lua";

init_by_lua_file "/usr/local/openresty/nginx/conf/waf/init.lua";

access_by_lua_file "/usr/local/openresty/nginx/conf/waf/access.lua";

lua_shared_dict limit 10m;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server {

listen 80;

server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location / {
    root   html;
    index  index.html index.htm index.php;
}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html

error_page   500 502 503 504  /50x.html;

location = /50x.html {
    root   html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

location ~ \.php$ {
    proxy_pass   http://127.0.0.1;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ \.php$ {
   root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /document_root$fastcgi_script_name;
   include        fastcgi_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#    deny  all;
#}

}

# another virtual host using mix of IP-, name-, and port-based configuration

#server {

listen 8000;

listen somename:8080;

server_name somename alias another.alias;

location / {

root html;

index index.html index.htm;

}

#}

HTTPS server

#server {

listen 443 ssl;

server_name localhost;

ssl_certificate cert.pem;

ssl_certificate_key cert.key;

3053 次点击
所在节点    程序员
1 条回复
Showfom
2018-04-07 18:48:56 +08:00
建议去换个眼镜,那么明显两行重复了

lua_shared_dict limit 50m;
lua_shared_dict limit 10m;

选一个呗

https://stackoverflow.com/questions/49675745/nginx-emerg-the-size-10485760-of-shared-memory-zone-limit-conflicts-with-al 这个也是你发的把,可以去终结了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/444874

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX