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"
47 ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
48 ssl.ca-file = "/etc/lighttpd/ssl/ca.pem"
50 # fix for problem between curl and lighttpd
51 server.reject-expect-100-with-417 = "disable"
53 # Send everybody to landing
55 $SERVER["socket"] == ":80" {
57 $HTTP["scheme"] == "http" {
58 $HTTP["host"] =~ ".*" {
59 # This next redirect doesn't appear to ever execute in
61 # (sometimes, anyway -- caching issue?), but it does seem
63 # reliably in Google's Chromium browser. If I change it
65 # and restart Lighty, Firefox still goes to the URL in
67 # last 'else' below. Or something.
69 server.document-root = "/var/www"
70 url.redirect = (".*" => "https://example.com")
75 else $SERVER["socket"] == ":443" {
77 $HTTP["scheme"] == "https" {
79 $HTTP["host"] == "wordpress.example.com" {
80 server.document-root = "/var/www/wordpress"
81 ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
84 url.rewrite-if-not-file = (
85 "^/(.*/)?files/$" => "/index.php",
86 "^/(.*/)?files/(.*)" => "/wp-includes/ms-files.php?file=$2",
87 "^(/wp-admin/.*)" => "$1",
88 "^/([_0-9a-zA-Z-]+/)?(wp-.*)" => "/$2",
89 "^/([_0-9a-zA-Z-]+/)?(.*\.php)" => "/$2",
90 "^/(.*)/?$" => "/index.php/$1"
93 else $HTTP["host"] == "friendica.example.com" {
94 server.document-root = "/var/www/friendica"
95 ssl.pemfile = "/etc/lighttpd/ssl/friendica.pem"
96 # Got the following 'Drupal Clean URL'after Mike suggested
98 # something along those lines, from
99 http://drupal.org/node/1414950
100 url.rewrite-if-not-file = (
101 "^\/([^\?]*)\?(.*)$" => "/index.php?q=$1&$2",
102 "^\/(.*)$" => "/index.php?q=$1"
105 else $HTTP["host"] !~ "(friendica.example.com|wordpress.example.com)" {
106 server.document-root = "/var/www/wordpress"
107 ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
108 url.redirect = (".*" => "https://wordpress.example.com/main/")
114 index-file.names = ( "index.php", "index.html",
115 "index.htm", "default.htm",
116 "index.lighttpd.html" )
118 url.access-deny = ( "~", ".inc" )
120 static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
122 include_shell "/usr/share/lighttpd/use-ipv6.pl"
124 dir-listing.encoding = "utf-8"
125 server.dir-listing = "disable"
127 #compress.cache-dir =
128 "/var/cache/lighttpd/compress/"
129 #compress.filetype = ( "application/x-javascript", "text/css",
130 "text/html", "text/p\
135 include_shell "/usr/share/lighttpd/create-mime.assign.pl"
136 include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
138 ---------------( config ends )-----------------