Lighttpd configuration

Jan Tojnar edited this page Apr 9, 2017 · 13 revisions

lighttpd configuration

 url.rewrite-once += (
 "^/selfoss/favicon.ico$" => "/selfoss/public/favicon.ico",
 "^/selfoss/favicons/(.*)$" => "/selfoss/data/favicons/$1",
 "^/selfoss/thumbnails/(.*)$" => "/selfoss/data/thumbnails/$1",
 "^/selfoss/([^\?]*.(js|ico|gif|jpg|png|css|asc|txt|eot|woff|ttf|svg))(\?.*)?$" => "/selfoss/public/$1",
 "^/selfoss/index.php(.*)$" => "$0",
 "^/selfoss/([^\?]*)(\?(.*))?" => "/selfoss/index.php?$3",
 "^/selfoss/public/" => "$0",
 "^/selfoss/(.*)" => "/selfoss/index.php$1"
 )

This is in the case that you have selfoss installed in a subdirectory named selfoss, like http://yourdomain/selfoss/

If you have installed selfoss at the root folder of your web server, then you just need to remove selfoss references from the rules above.

Note (alternative setup): probably a more terse and a bit more secure (restrictive) setup is

  url.rewrite-once = (
    "^/selfoss/favicon.ico$" => "/selfoss/public/favicon.ico",
    "^/selfoss/favicons/(.*)$" => "/selfoss/data/favicons/$1",
    "^/selfoss/thumbnails/(.*)$" => "/selfoss/data/thumbnails/$1",
    "^/selfoss/([^\?]*\.(js|ico|gif|jpg|png|css|asc|txt|eot|woff|ttf|svg))(\?.*)?$" => "/selfoss/public/$1",
    #"^/selfoss/(.*?)(\?.+)?" => "/selfoss/index.php/$1$2",
    "^/selfoss/(.*)" => "/selfoss/index.php$1"
  )

Optional: Compression settings

It is possible to set up automatic compression for the javascript as

  server.modules += ( "mod_compress" )
  compress.cache-dir         = "/var/www/cache/compress/"
  compress.filetype          = ("text/plain", "text/html", "text/javascript")

The compression of the feed pages themselves can be arranged by php by adding

  zlib.output_compression = On

to php.ini (check, where is it on your system), or by

  php_flag zlib.output_compression On

in .htaccess file, which is still consulted by php even though it is running under lighttpd

Upgrading from selfoss 2.17 or lower

Since version 2.18, selfoss uses query strings to bust cache. If you used the directives similar to the ones above, you will need to add support for query strings – replace

 "^/selfoss/(.*.(js|ico|gif|jpg|png|css|asc|txt|eot|woff|ttf|svg))$" => "/selfoss/public/$1",

with

 "^/selfoss/([^\?]*.(js|ico|gif|jpg|png|css|asc|txt|eot|woff|ttf|svg))(\?.*)?$" => "/selfoss/public/$1",
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.