Seafile and lighttpd

1,430 views
Skip to first unread message

Paul Andreas

unread,
Oct 9, 2013, 5:29:09 AM10/9/13
to sea...@googlegroups.com
I ran into some trouble trying to install seafile behind lighttpd (as opposed to nginx or apache). Just so other people have a reference I will write up what I did.
First: as far as I can tell almost everything works:
  • Webinterface up and downloading for encrypted and unencrypted libraries
  • Linux 2.0 and Macos 1.8 desktop clients with encrypted and unencrypted libraries
  • Android client for unencrypted libraries or encrypted libraries that are currently open in a browser
What does not work:
  • Android for encrypted libraries that are not currently open in a browser.
I used the following configuration, seafile runs on the vhost "seafile.mail", which is also added to the seafile and ccnet config files as in the apache tutorial. For rewriting together with proxying there needs to be an additional vhost running on another port because lighttpd 1.4.28 does not support rewrite-then-conditional-proxy natively.


For lighttpd I converted the apache configs as best I could to lighttpd. I came up with the following config for seafile. You should also load the proxy, fastcgi, rewrite modules in your lighttpd config. Hope my results help somebody to get it setup more quickly than I did.

For rewrite:
$HTTP["host"]=~"seafile.mail" {
url.rewrite-once += (
        "^/seafhttpd(.*)$" => "$1",
)
url.rewrite+= (
"^(media.*)$" => "$1"
)
url.rewrite-if-not-file += (
"^(.*)$" => "/seahub.fcgi$1"
)
}

For fastcgi:
$HTTP["host"]=~"seafile.mail" {
fastcgi.server+=( "/seahub.fcgi" =>
  (( "host"=>"127.0.0.1",
      "port"=>"8000",
      "check-local"=>"disable",
      "allow-x-send-file"=>"enable"
  ))
)
}

For alias:
$HTTP["host"]=~"seafile.mail" {
alias.url += (
        "/media" => "<dir of seafile server>/seahub/media",
)
}

For proxy (notice the dirty fix for the rewriting):
$HTTP["host"]=~ "seafile.mail" {
 accesslog.filename= "/var/log/lighttpd/accesslog_seafile"
$HTTP["url"] =~ "(^/seafhttp)" {
  proxy.server  = ( "" => (
    "webapp:80" => # name
      ( "host" => "127.0.0.1",
        "port" => 81
      )
    )
  )
}
}

# Part for proxy listening on port 81
$SERVER["socket"] == ":81" {
  url.rewrite-once = ( "^/seafhttp(.*)$" => "$1" )
  proxy.server  = ( "" => (
    "webapp:81" => # name
      ( "host" => "127.0.0.1",
        "port" => 8082
      )
    )
  )
}

Finally as I want to use SSL:
$HTTP["scheme"] == "http" {
        $HTTP["host"]=~ ".*" {
                url.redirect += ("^/sea.*" => "https://%0$0")
        }
}


Message has been deleted

Paul Andreas

unread,
Mar 10, 2014, 1:52:27 PM3/10/14
to sea...@googlegroups.com
Sorry I think there was a typo in my previous post. For current seafile versions you need to change the block titled "for proxy" in the initial post to:

$HTTP["host"]=~ "seafile.mail" {
 accesslog.filename= "/var/log/lighttpd/accesslog_seafile"
$HTTP["url"] =~ "(^/seafhttp)" {
  proxy.server  = ( "" => (
    "webapp:80" => # name
      ( "host" => "127.0.0.1",
        "port" => 81
      )
    )
  )
}
 $HTTP["url"] =~ "(^/files)" {#new block
  proxy.server  = ( "" => (
    "webapp:80" => # name
      ( "host" => "127.0.0.1",
        "port" => 8082
      )
    )
  )
}

Alexey Didenko

unread,
Dec 10, 2014, 3:03:04 AM12/10/14
to sea...@googlegroups.com
Paul, hello!
Can you help me?

I have got a gateway, which has ip 10.0.4.150, based on Lighttpd.
And Seafile server on another host(10.0.4.152). Seafile server starts automatically by script.

I'm trying to make proxy from gateway to Seafile host. In config file I write:
$HTTP["url"] =~ "^/docs(.*)$" {
proxy.server = ( "" => ( (
"host" => "10.0.4.152",
"port" => 8000 ) ) )
}

When I'm going to http://10.0.4.150/docs, I see Seafile message, that page is not found.
How to make transparent proxy?

Thanks!

понедельник, 10 марта 2014 г., 20:52:27 UTC+3 пользователь Paul Andreas написал:
Reply all
Reply to author
Forward
0 new messages