Reputation: 751
I have installed openresty nginx server. Here is my config file:
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;
}
}
}
The lua file references here is taken from http://www.pataliebre.net/howto-make-nginx-decompress-a-gzipped-request.html to support accepting request in gzip format at nginx end.
When I start the server it is started but sending a request in gzip format throws an internal server error with these errors:
/opt/se/nginx-scripts/inflate_body.lua:20: in function 'inflate_body' /opt/se/nginx-scripts/inflate_body.lua:57: in function , client: 192.168.3.30, server: , request: "POST / HTTP/1.1", host: "192.168.3.30:81" 2018/06/06 15:08:28 [error] 36232#36232: *1 lua entry thread aborted: runtime error: /opt/se/nginx-scripts/inflate_body.lua:20: module 'zlib' not found: no field 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/local/openresty/lualib/ngx/zlib.lua' no file '/usr/local/openresty/site/lualib/zlib.lua' no file '/usr/local/openresty/site/lualib/zlib.ljbc' no file '/usr/local/openresty/site/lualib/zlib/init.ljbc' no file '/usr/local/openresty/lualib/zlib.ljbc' no file '/usr/local/openresty/lualib/zlib/init.ljbc' no file '/usr/local/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.0-beta3/zlib.lua' no file '/usr/local/share/lua/5.1/zlib.lua' no file '/usr/local/share/lua/5.1/zlib/init.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/zlib.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/zlib/init.lua' no file '/usr/local/openresty/zlib.so' no file '/usr/local/openresty/lualib/zlib.so' no file '/usr/local/openresty/lualib/resty/zlib.so' no file '/usr/local/openresty/lualib/ngx/zlib.so' no file '/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 file '/usr/local/openresty/luajit/lib/lua/5.1/zlib.so' no file '/usr/local/lib/lua/5.1/loadall.so'
After reading for this issue on internet, I tried to setup the lua_package_path and lua_package_cpath manually but still that didn't help. I am not sure what other step should I take to fix this issue?
Upvotes: 0
Views: 1500
Reputation: 3064
Your system doesn't have appropriate zlib shared module installed.
On debian style distro this works for me: sudo apt-get install zlib1g
.
If you have something else find appropriate package.
Upvotes: 0