我已经安装了openresty服务器。下面是我的配置文件:
http {
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 /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
# set search paths for pure Lua external libraries (';;' is the default path):
lua_package_path '/usr/local/openresty/?.lua;/usr/local/openresty/lualib/?.lua;/usr/local/openresty/lualib/resty/?.lua;/usr/local/openresty/lualib/ngx/?.lua;/usr/local/openresty/site/lualib/?.lua;;';
# set search paths for Lua external libraries written in C (can also use ';;'):
lua_package_cpath '/usr/local/openresty/?.so;/usr/local/openresty/lualib/?.so;/usr/local/openresty/lualib/resty/?.so;/usr/local/openresty/lualib/ngx/?.so;/usr/local/openresty/site/lualib/?.so;;';
server {
listen 81;
location / {
proxy_pass http://localhost:4040;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Cluster-Client-Ip $remote_addr;
proxy_pass_request_headers on;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# for deflate/uncompress request
client_max_body_size 512k;
client_body_buffer_size 512k;
set $max_chunk_size 10240;
set $max_body_size 524288;
rewrite_by_lua_file /opt/se/nginx-scripts/inflate_body.lua;
}
}
}这里的lua文件引用来自http://www.pataliebre.net/howto-make-nginx-decompress-a-gzipped-request.html,以支持在nginx端接受gzip格式的请求。
当我启动服务器时,会启动它,但是以gzip格式发送请求会引发一个内部服务器错误,其中包含以下错误:
/opt/se/nginx-script/nginx_POST.1.1:20:函数'inflate_body‘/opt/se/nginx-script/nginx_POST.1.1:57:在函数中,客户机: 192.168.3.30,服务器:,请求:"POST / HTTP/1.1",主机:"192.168.3.30:81“2018/06/06 15:08:28 36232#36232:*1 lua入口线程中止:运行时错误:/opt/se/nginx-script/ field _host.lua:20:模块'zlib‘找不到:没有字段package.preload'zlib’no file '/usr/local/openresty/zlib.lua‘no file '/usr/local/openresty/lualib/zlib.lua’no file‘usr/local/openresty/lualib/resty/zlib.lua‘no file’/usr/usr/local/openresty/lualib/ngx/zlib.lua‘no file’/usr/local/openresty/site/usr/usr/local/openresty/site/lualib/zlib.ljbc‘no file '/usr/local/openresty/site/lualib/zlib/init.ljbc’no‘/usr/local/openresty/lualib/lualib/zlib.ljbc’没有文件。'/usr/local/openresty/lualib/zlib/init.ljbc‘no file’/usr/openresty/site/lualib/zlib.lua‘no file '/usr/local/openresty/site/lualib/zlib/init.lua’no file '/usr/local/openresty/lualib/zlib.lua‘no file '/usr/local/openresty/lualib/zlib/init.lua’no file './zlib.lua‘no file '/usr/local/openresty/luajit/share/luajit-2.1.0beta 3/zlib.lua‘no file '/usr/local/share/lua/5.1/zlib.lua’no file '/usr/local/share/lua/5.1/zlib/init.lua‘没有文件'/usr/local/openresty/luajit/share/lua/5.1/zlib.lua’没有文件'/usr/local/openresty/luajit/share/lua/5.1/zlib/init.lua‘因此,没有文件/usr/local/openresty/zlib.so‘usr/local/openresty/lualib/zlib.so’no file‘/usr/local/openresty/lualib/r校/zlib.so’no file‘/usr/openresty/lualib/zlib.so’usr/local/openresty/site/lualib/zlib.so‘no file '/usr/local/openresty/site/lualib/zlib.so’no file‘。没有文件'/usr/local/openresty/lualib/zlib.so‘no file './zlib.so’no file '/usr/local/lib/lua/5.1/zlib.so‘no '/usr/local/openresty/luajit/lib/lua/5.1/zlib.so’no file '/usr/local/lib/lua/5.1/loadall.so‘
在互联网上阅读了这个问题后,我尝试手动设置lua_package_path和lua_package_cpath,但仍然没有帮助。我不知道我还应采取什么其他步骤来解决这个问题?
发布于 2018-06-06 11:12:09
您的系统没有安装适当的zlib共享模块。
在debian风格发行版上,这个版本适合我:sudo apt-get install zlib1g。
如果你有其他的东西,找到合适的包裹。
https://stackoverflow.com/questions/50717932
复制相似问题