在我们的开发服务器上,我们允许多个开发人员访问服务器以git提取他们的更改.通常这需要运行sudo systemctl reload php-fpm(或发送USR2等).但是,我们希望允许他们在不需要sudo的情况下在PHP-FPM中重新加载更改的代码.
当我以前使用Ruby时,你可以通过触摸tmp目录中名为restart.txt的文件来完成我正在寻找的东西.
PHP-FPM是否支持这样的东西?或者,无论如何都允许重载命令(或任何类似的发送USR2的方法)没有sudo?
解决方法:
在/ etc / sudoers文件中将命令列入白名单时,您可能会在那里:
首先编辑sudoers文件:
sudo visudo
添加以下配置行:
user ALL=(root) NOPASSWD: systemctl reload php-fpm
Replace user (at the beginning of the line) with the real username, for whom the command is executed.
这将特权用户调用sudo systemctl reload php-fpm以root身份执行(无密码).
标签:php,sudo,fpm
来源: https://codeday.me/bug/20190627/1307678.html