开发者

Enable Browser-Caching for lighttpd/thin

开发者 https://www.devze.com 2023-04-03 22:14 出处:网络
I have the problem that Googles “Page Speed” says that I should enable browser caching. I am usein a lighttpd server as a proxy for different web server on my server. One of them is a rails app (Ru

I have the problem that Googles “Page Speed” says that I should enable browser caching.

I am usein a lighttpd server as a proxy for different web server on my server. One of them is a rails app (Ruby 1.9.2/Rails 2.3.x) running with thin server.

I thought that I have to enable “mod_expire” in the lighttpd proxy and use the setting开发者_StackOverflow社区s:

expire.url = ("/favicon.ico"  => "access plus 7 days",
         "/stylesheets/" => "access plus 7 days",
         "/javascripts/" => "access plus 7 days",
         "/images"        => "access plus 7 days"
         )

But it did not work. I also moved the expire.url code to:

$HTTP["host"] =~ "myRailsApp" {
  expire.url = ...
  proxy.balance = "fair"
  proxy.server = (
    "/" => (
    (
      "host" => "11.22.33.44",
      "port" => 2000
    ),
    (
      "host" => "11.22.33.44",
      "port" => 2001
    )
  )
}

It did not work, either.

So my question is: How can I enable the browser caching for my lighttpd/thin setting?

Unfortunately, Google did not help me.


It is also possible to use a condition, e.g.:

[

...]
      $HTTP["url"] =~ "^/images/" {
         expire.url = ( "" => "access plus 1 hours" )
}
[...]
0

精彩评论

暂无评论...
验证码 换一张
取 消