1 Below is a sample config for Lighttpd that
2 seems to work well on Debian Squeeze, with "lighttpd/1.4.28 (ssl)"
4 The idea is: if someone enters the bare URL for my site, 'example.com',
5 they get redirected to https://example.com/index.html, which is simply a
6 page with two links on it: https://wordpress.example.com and
7 https://friendica.example.com.
9 If someone enters https://example.com, they get redirected to
10 https://wordpress.example.com/main/, which is the 'main' blog in a Word
11 Press 'network install' of the 'subdirectory' variety.
13 I thought it might be nice to offer people who join my Friendica
14 instance their own blogs, if they like.
16 One can obtain free, signed, single subdomain SSL certificates from
17 StartCom CA, which upon checking I noticed was already installed in both
18 Firefox and Google Chromium. Info at http://cert.startcom.org/ . So I
19 got one for each site, and have Lighty use the appropriate cert based on
24 ---------------( config starts )-----------------
26 debug.log-request-handling = "disable"
27 debug.log-condition-handling = "disable"
38 server.document-root = "/var/www"
39 server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
40 server.errorlog = "/var/log/lighttpd/error.log"
41 server.pid-file = "/var/run/lighttpd.pid"
42 server.username = "www-data"
43 server.groupname = "www-data"
46 ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
47 ssl.ca-file = "/etc/lighttpd/ssl/ca.pem"
49 # Send everybody to landing
51 $SERVER["socket"] == ":80" {
53 $HTTP["scheme"] == "http" {
54 $HTTP["host"] =~ ".*" {
55 # This next redirect doesn't appear to ever execute in
57 # (sometimes, anyway -- caching issue?), but it does seem
59 # reliably in Google's Chromium browser. If I change it
61 # and restart Lighty, Firefox still goes to the URL in
63 # last 'else' below. Or something.
65 server.document-root = "/var/www"
66 url.redirect = (".*" => "https://example.com")
71 else $SERVER["socket"] == ":443" {
73 $HTTP["scheme"] == "https" {
75 $HTTP["host"] == "wordpress.example.com" {
76 server.document-root = "/var/www/wordpress"
77 ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
80 url.rewrite-if-not-file = (
81 "^/(.*/)?files/$" => "/index.php",
82 "^/(.*/)?files/(.*)" => "/wp-includes/ms-files.php?file=$2",
83 "^(/wp-admin/.*)" => "$1",
84 "^/([_0-9a-zA-Z-]+/)?(wp-.*)" => "/$2",
85 "^/([_0-9a-zA-Z-]+/)?(.*\.php)" => "/$2",
86 "^/(.*)/?$" => "/index.php/$1"
89 else $HTTP["host"] == "friendica.example.com" {
90 server.document-root = "/var/www/friendica"
91 ssl.pemfile = "/etc/lighttpd/ssl/friendica.pem"
92 # Got the following 'Drupal Clean URL'after Mike suggested
94 # something along those lines, from
95 http://drupal.org/node/1414950
96 url.rewrite-if-not-file = (
97 "^\/([^\?]*)\?(.*)$" => "/index.php?q=$1&$2",
98 "^\/(.*)$" => "/index.php?q=$1"
101 else $HTTP["host"] !~ "(friendica.example.com|wordpress.example.com)" {
102 server.document-root = "/var/www/wordpress"
103 ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
104 url.redirect = (".*" => "https://wordpress.example.com/main/")
110 index-file.names = ( "index.php", "index.html",
111 "index.htm", "default.htm",
112 "index.lighttpd.html" )
114 url.access-deny = ( "~", ".inc" )
116 static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
118 include_shell "/usr/share/lighttpd/use-ipv6.pl"
120 dir-listing.encoding = "utf-8"
121 server.dir-listing = "disable"
123 #compress.cache-dir =
124 "/var/cache/lighttpd/compress/"
125 #compress.filetype = ( "application/x-javascript", "text/css",
126 "text/html", "text/p\
131 include_shell "/usr/share/lighttpd/create-mime.assign.pl"
132 include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
134 ---------------( config ends )-----------------