在我的网站上访问某些 PHP 脚本时,我收到了可怕的 500 错误消息。我想知道修复它有什么问题,但 Nginx 没有在我指定的日志文件中记录任何 PHP 错误。这是我的服务器块:
server {
listen 80;
server_name localhost;
access_log /home/whitey/sites/localhost/logs/access.log;
error_log /home/whitey/sites/localhost/logs/error.log error;
root /home/whitey/sites/localhost/htdocs;
index index.html index.php /index.php;
location / {
}
location ~ \.php$ {
fastcgi_pass unix:/tmp/phpfpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
}
}
Run Code Online (Sandbox Code Playgroud)
请注意,有些 PHP 脚本可以正常工作,而有些则不行。所以 PHP 不存在全局问题,只是这些脚本中的某些内容导致 Nginx 抛出 500 错误。
我怎样才能找到这个问题的根源?唯一的问题error.log是找不到有关 favicon.ico 的错误。