NginX导致PHP文件被执行两次
我处于一个困难的地方,试图弄明白为什么会这样。 出于某种原因,当我打开我的网站的index.php文件正在执行。 我已经能够通过添加file_put_contents('runs.txt', 'executed'.PHP_EOL, FILE_APPEND);将其缩小到NginX / PHP-FPM file_put_contents('runs.txt', 'executed'.PHP_EOL, FILE_APPEND); 到index.php的顶部,并使用网站和命令行执行它。 如果我从命令行执行它,它只输出一个executed ,而如果我从网站(通过NginX) executed它输出两个executed 。 该脚本也没有redirect到自身,因为它只是返回200响应代码。 除了通过执行脚本两次使用更多的内存之外,还通过使CSRF再次生成来消除CSRF保护,因此CSRF是无用的。 下面是我的nginxconfiguration文件: nginx.conf user nginx; worker_processes 2; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log […]