如果您告诉 Apache 使用 CustomLog 文件,Apache2 将在启动时创建这些文件。它总是将它们提供给用户 root:root。我怎样才能改变这种行为?
背景
Apache 运行
SuexecUserGroup www-data www-data
Run Code Online (Sandbox Code Playgroud)
同时,我使用 CustomLog 将其输出通过管道传输到脚本。该脚本从 IP 中删除两个字节,然后写入日志文件。由于您不能告诉 Apache 从 error.log 中省略 IP,因此此管道输出很重要(关于德国隐私法)。
如果这不属于www-data ,则脚本无法访问我的自定义日志。
如果我更换所有者,一切正常。
我也知道如何在logrotate重命名和重新创建日志文件时更改文件所有者。
但是,如果我停止 Apache 进程,删除日志文件,然后重新启动 Apache 进程,则会创建属于 root:root 的新文件。
如何告诉 Apache在启动时为www-data创建新的空文件?
我的网络服务器使用 php5-fpm 运行 nginx。如果出现一些问题,通常是php5-fpm挂了,导致“bad gateway”服务器错误。当然,我永远不知道 nginx 是否会在某一天崩溃。
当发生某些事情时,这两个进程(广告它们的线程)通常都存在并且需要重新启动。我对当前问题的原因不太感兴趣,但想重新启动两个进程。为此,我创建了两个 bash 脚本 /etc/monit/webserver.start.sh 和 /etc/monit/webserver.stop.sh。
这是我的 monit 配置文件(在 conf.d 中):
check process webserver with pidfile /var/run/nginx.pid
start program = "/etc/monit/webserver.start.sh"
stop program = "/etc/monit/webserver.stop.sh"
if failed (url https://www.myserver.com/example/ and content == 'test string' and timeout 20 seconds)
then alert
if failed (url https://www.myserver.com/example/ and content == 'test string' and timeout 20 seconds)
for 2 cycles
then restart
if failed (url https://www.myserver.com/example/ and content == 'test string' and timeout 20 seconds)
for 4 …
Run Code Online (Sandbox Code Playgroud) 我正在使用 Ubuntu 16 运行网络服务器并php-fpm
处理 PHP 请求。php-fpm
已通过apt-get
默认 Ubuntu 存储库安装。
根据这个参考我应该能够运行php-fpm -t
来测试配置。然而,这只告诉我,没有php-fpm
. 我很确定,它是(包含 PHP 处理的网络服务器运行良好,并且服务 php7.0-fpm 已启动并运行)......但没有名为php-fpm
.
如何php-fpm
在重新加载配置之前使用 PHP 7测试配置更改?