我一直在尝试在 php-fpm 和 nginx 中记录错误,因为我在网上找不到任何好的解释。大多数指南说如果我想将错误从 php5-fpm 发送回 nginx,我应该更改catch_workers_output
为yes
。但是,在我的实验中,我发现即使catch_workers_output
设置为no
,nginx 仍会正确记录错误。
这是我的虚拟主机配置:
server {
server_name domain.com;
return 301 http://www.domain.com$request_uri;
access_log off;
}
server {
listen 80;
listen [::]:80;
root /home/websites/domain.com;
index index.php index.html index.htm;
error_log /home/websites/logs/domain.com/error.log warn;
access_log /home/websites/logs/domain.com/access.log;
#switch on gzip
gzip on;
gzip_min_length 1100;
gzip_buffers 10 32k;
gzip_types text/plain application/x-javascript text/xml text/css;
gzip_vary on;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~* .(gif|jpg|jpeg|png|css|js|ico)$ {
expires 30d;
access_log off;
}
error_page …
Run Code Online (Sandbox Code Playgroud)