G
G
gremlintv22018-11-15 15:02:53
Nginx
gremlintv2, 2018-11-15 15:02:53

What is the catch when trying to use the lua-md5 module in nginx (details under the cut)?

Hello, as a newbie (and even more so lua) in the development environment, I can’t figure out the issue of correctly connecting the lua-md5 module:

ngx.header["Content-Type"] = "text/plain;charset=utf-8";
local cache_key = ngx.var.lua_purge_upstream .. ngx.var.request_uri;
ngx.print(cache_key);
local md5 = require 'md5'
local md5sum = md5.sumhexa(cache_key);
ngx.print(md5sum);

When accessed, nginx throws an error c
curl: (52) Empty reply from server

How does the following work:
ngx.header["Content-Type"] = "text/plain;charset=utf-8";
local cache_key = ngx.var.lua_purge_upstream .. ngx.var.request_uri;
ngx.print(cache_key);
local md5 = ngx.md5
local md5sum = md5(cache_key);
ngx.print(md5sum);

1) Are these 2 options identical in result or are they different?
Tried installing lua-md5 module like this:
a)
https://centos.pkgs.org/7/epel-x86_64/luarocks-2.3...
luarocks install --server= luarocks.org/manifests/kikito

b)
dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/...

2) But the first way (through the lua-md5 module) didn't work (perhaps you need to specify some environment variables)?
3) Can you advise a beginner on materials for learning lua on this topic (except for Google, of course)?
There is a need to clear the nginx cache one by one, wildcard and the entire cache:
https://gist.github.com/nosun/0cfb58d3164f829e2f02...
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gremlintv2, 2018-11-15
@gremlintv2

The first task was solved by installing:
https://github.com/keplerproject/md5
1) The commands are identical in result

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question