如何使用最少的服务器进行反向代理来提供静态内容?

发布于 2024-11-27 11:26:58 字数 55 浏览 3 评论 0原文

考虑使用lighttpd 提供静态内容,然后使用在不同服务器上运行的apache 提供动态内容。

Thinking of serving up static content with lighttpd and then dynamic content with apache running on a different server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三人与歌 2024-12-04 11:26:58

如果问题只是如何仅代理动态请求,您可能可以在lighttpd配置中使用类似以下内容:

$HTTP["url"] !~ "^/static" {
    proxy.server  = ( 
        "" => (
            (
                "host" => "10.0.0.2", "port" => 8080 )
            )
        )
}

然后,将静态内容(图像、CSS、Javascript等)放在/static下;这样,它们将直接由 Lighty 提供服务,而其他请求将被代理到 10.0.0.2、端口 8080 上的 Apache(根据需要进行调整。)

If the question is simply how to proxy only dynamic requests, you could probably use something like the following in your lighttpd config:

$HTTP["url"] !~ "^/static" {
    proxy.server  = ( 
        "" => (
            (
                "host" => "10.0.0.2", "port" => 8080 )
            )
        )
}

Then, put your static content (images, CSS, Javascript etc) under /static; that way, they'll be served directly by Lighty, while other requests will be proxied to Apache on 10.0.0.2, port 8080 (adjust as appropriate.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文