Using lua-nginx-module. And I'm unable to accomplish a thing wherein I'm want to modify the mtime of a file(touch.txt
).
I tried using ..
os.execute("touch /app/directory/touch.txt")
and this
io.open('/app/directory/touch.txt','w').close()
But none of the above is working ..
Here how my nginx.conf looks like this ..
location / {
auth_basic "Prohibited area";
auth_basic_user_file /etc/apache2/.htpasswd;
default_type 'text/plain';
content_by_lua_block {
os.execute('/usr/bin/touch /app/directory/touch.txt')
local time = os.date("%m/%d/%Y %I:%M:%S %p")
ngx.say('Hello,world! '.. time)
}
proxy_redirect off;
}
I see the time returned i.e (Hello,world! '.. time
) in browser correctly but the mtime of touch.txt
remain still the same.
Any things over here .. that I need to take care of.