- 错误提示
nginx: [emerg] zero size shared memory zone "perip"
- 错误原因
nginx.conf 中 limit_conn_zone配置问题 - 解决方案
- 将nginx.conf 中 limit_conn_zone $binary_remote_addr zone=name:10m; (注:perip是自定义名)
- name 为perip 的配置注释掉
- 重启 openresty 即可
- 附上本人完整 nginx.conf
user root root;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
lua_shared_dict dis_cache 128m;
limit_req_zone $binary_remote_addr zone=contentRateLimit:10m rate=2r/s;
limit_conn_zone $binary_remote_addr zone=addr:1m;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location /brand {
limit_conn addr 2;
proxy_pass http://192.168.0.51:18081;
}
location /update_content {
content_by_lua_file /root/lua/update_content.lua;
}
location /read_content {
limit_req zone=contentRateLimit burst=4 nodelay;
content_by_lua_file /root/lua/read_content.lua;
}
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
root html;
}
}
}