作者:手机用户2502907603 | 来源:互联网 | 2017-05-13 02:18
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 <= lines; i++) {
$numbering.append($('
').text(i));
};
$numbering.fadeIn(1700);
});
});
以上就介绍了ngx_lua实现重启php,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。