将 PHP 标头传递给 NGinx 代理

将 PHP 标头传递给 NGinx 代理

我在 APACHE 前面设置了 nginx 作为代理,然后 APACHE 与 PHP-FPM 进行通信。

事实证明,nginx 正在切断(或者更好地说不传递)通过 header('foo: bar') 命令直接在 PHP 中设置的标头。

也就是我看到下面的图片:

PHP 我设置了以下标头: - cache-control - pragma - expires

如果我不是通过 nginx 代理而是直接通过 apache 打开页面,我就会看到这些。

现在,当我通过 nginx > 打开页面时,以上所有内容都消失了,并且 cache-control 被完全替换了 :/

我在 nginx 配置中有以下额外指令,旨在缓存所有图像和静态文件至少 30 天:

tcp_nopush on;
tcp_nodelay on;
access_log off;
expires       30d;
keepalive_timeout 30;
keepalive_requests 1000;
reset_timedout_connection on;
client_body_timeout 10;
send_timeout 2;

无论我怎么尝试都不起作用 > 似乎 nginx 通常会忽略来自 apache 的所有标头。有什么办法可以解决这个问题吗?

相关内容