-1

我有带有清漆(:80)+ nginx(:8080)的服务器。Nginx 是其他 apache 网络服务器的前端。

apache werbserver 上有很多重定向。重定向使用相对位置,例如:

header('Location: /en/')

所以我得到如下链接:

http://example.com:8080/en/

我无法更改 apache 服务器上的重定向。所以我需要在nginx上重写它。什么是重定向到http://example.com/en/的最佳方式

4

1 回答 1

1

如果 nginx 正在代理 apache,您将无法像在 apache 中那样使用 Location 标头。您需要rewrite在 nginx 中使用该指令。这篇文章很好地解释了在apache 和 nginx中使用重写。

您可能还会发现以下文章很有用,因为您正在重定向位于 varnish 后面的 nginx 服务器。

http://danielmiessler.com/blog/handling-redirects-with-varnish-and-nginx

于 2013-07-10T22:57:07.840 回答