Project

General

Profile

[Solved] Rewrite Entries in lighttpd.conf using multiple (2) instances of dokuwiki

Added by epikur over 10 years ago

Hey everyone.
Lets assume I would like to have multiple (2) instances of dokuwiki running on one BananaPi (Lubuntu).

Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty

lighttpd and dokuwiki are working fine as long as I am changing 'var.dokudir' and the asssociating rewrites for one of the dokuwikis in use manually in /etc/lighttpd/lighttpd.conf.

Now the question: Can I provide rewrite entries for both dokuwikis at the same time in lighttpd.conf and if yes, how would they have to look like?

So given the variables and folders:

var.dokudir = "/dokuwiki" (1st dokuwiki)
var.wakedir = "/wake" (2nd dokuwiki)
.
.

  1. rewrites for dokuwiki
    $HTTP["url"] = ...
    ???

Hoping the description was confusing enough ;)
I appreciate any helpful advice.

Thanks in advance

original /etc/lighttpd/lighttpd.conf: ######################################################################################################
  1. variables
    var.basedir = "/var/www/"
    var.logdir = "/var/log/lighttpd"
    var.statedir = "/var/lib/lighttpd"
    var.dokudir = "/dokuwiki"
server.modules = (
"mod_rewrite"
  1. "mod_redirect",
  2. "mod_alias",
  3. "mod_access",
  4. "mod_auth",
  5. "mod_status",
  6. "mod_setenv",
  7. "mod_fastcgi",
  8. "mod_proxy",
  9. "mod_simple_vhost",
  10. "mod_evhost",
  11. "mod_userdir",
  12. "mod_cgi",
  13. "mod_compress",
  14. "mod_ssi",
  15. "mod_usertrack",
  16. "mod_expire",
  17. "mod_secdownload",
  18. "mod_rrdtool",
  19. "mod_accesslog"
    )

server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80

index-file.names = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )

  1. rewrites for dokuwiki
    $HTTP["url"] =~ "^" + var.dokudir { index-file.names = ("doku.php") }
    url.rewrite = (
    "^" + var.dokudir + "/lib/.*$" => "$0",
    "^" + var.dokudir + "/_media/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1&$2",
    "^" + var.dokudir + "/_media/(.*)$" => var.dokudir + "/lib/exe/fetch.php?media=$1",
    "^" + var.dokudir + "/_detail/(.*)?\?(.*)$" => var.dokudir + "/lib/exe/detail.php?media=$1&$2",
    "^" + var.dokudir + "/_detail/(.*)?$" => var.dokudir + "/lib/exe/detail.php?media=$1",
    "^" + var.dokudir + "/_export/([^/]+)/(.*)\?(.*)$" => var.dokudir + "/doku.php?do=export_$1&id=$2&$3",
    "^" + var.dokudir + "/_export/([^/]+)/(.*)" => var.dokudir + "/doku.php?do=export_$1&id=$2",
    "^" + var.dokudir + "/doku.php.*" => "$0",
    "^" + var.dokudir + "/feed.php.*" => "$0",
    "^" + var.dokudir + "/(.*)\?(.*)" => var.dokudir + "/doku.php?id=$1&$2",
    "^" + var.dokudir + "/(.*)" => var.dokudir + "/doku.php?id=$1"
    )
  1. default listening port for IPv6 falls back to the IPv4 port
    1. Use ipv6 if available
      #include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
      include_shell "/usr/share/lighttpd/create-mime.assign.pl"
      include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

$HTTP["remoteip"] !~ "192.168.2.189" { $HTTP["url"] =~ "^/stats/" {
url.access-deny = ( "" )
}
} ###################################################################################################


Replies (1)

RE: Rewrite Entries in lighttpd.conf using multiple (2) instances of dokuwiki - Added by epikur over 10 years ago

In case someone else happens to be interested in the problem given above or similar ones:

##########################################################

url.rewrite-once = (
"<regex1>" => "<relative-uri1>",
"<regex2>" => "<relative-uri2>"
)

##########################################################

was the key to the solution.

Multiple Instances of dokuwiki working fine now without the need of dokuwiki farms.

    (1-1/1)