ngx_lua实现重启php
程序员文章站
2022-05-14 21:51:22
...
nginx
location /reload {
default_type text/html;
content_by_lua_file reload_php.lua;
}
lua
local args = ngx.req.get_query_args();
local uid = args["uid"]
local key = args["key"]
local uidmd5 = string.sub(ngx.md5(uid),0,12)
if key ~= uidmd5 then
ngx.say("Hey man, you can't do this.")
ngx.exit(200)
elselocal f = io.open("reload_access.log" , "a")
time = os.date("%c",os.time())
f:write(uid .. " " .. time)
f:close()
local command ="sh reload_php.sh"
--local command ="/bin/kill -USR2 `cat /var/run/php-fpm.pid`"
type = os.execute(command)
if type == 0 then
ngx.print("ok")
ngx.exit(200)
else
ngx.print("error")
f:write(" error")
f:close()
ngx.exit(200)
end
end
shell
#!/bin/bash##reload php-fpm##kill -USR2 `cat /var/run/php-fpm.pid`
killall php-fpm
/php/sbin/php-fpm -c /etc/php.ini -y /php/etc/php-fpm.conf
echo" ok" >> /reload_access.log
写这玩的,大神请指正。
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });以上就介绍了ngx_lua实现重启php,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
上一篇: php实现把url转换迅雷thunder资源下载地址的方法,
下一篇: 初级软件工程师起航!