2016-07-13 09:33:28 +02:00
|
|
|
Below is a sample config for Lighttpd that
|
2013-03-03 00:46:54 +01:00
|
|
|
seems to work well on Debian Squeeze, with "lighttpd/1.4.28 (ssl)"
|
|
|
|
|
|
|
|
The idea is: if someone enters the bare URL for my site, 'example.com',
|
|
|
|
they get redirected to https://example.com/index.html, which is simply a
|
|
|
|
page with two links on it: https://wordpress.example.com and
|
|
|
|
https://friendica.example.com.
|
|
|
|
|
|
|
|
If someone enters https://example.com, they get redirected to
|
|
|
|
https://wordpress.example.com/main/, which is the 'main' blog in a Word
|
|
|
|
Press 'network install' of the 'subdirectory' variety.
|
|
|
|
|
|
|
|
I thought it might be nice to offer people who join my Friendica
|
|
|
|
instance their own blogs, if they like.
|
|
|
|
|
|
|
|
One can obtain free, signed, single subdomain SSL certificates from
|
|
|
|
StartCom CA, which upon checking I noticed was already installed in both
|
|
|
|
Firefox and Google Chromium. Info at http://cert.startcom.org/ . So I
|
|
|
|
got one for each site, and have Lighty use the appropriate cert based on
|
|
|
|
the requested URL.
|
|
|
|
|
|
|
|
Enjoy!
|
|
|
|
|
2016-07-13 09:33:28 +02:00
|
|
|
On Debian Jessie with lighttpd 1.4.35-4 there was a problem encountered
|
2023-03-22 05:07:35 +01:00
|
|
|
between curl (which is used by Friendica in the background) and lighttpd.
|
2016-07-13 09:33:28 +02:00
|
|
|
This problem caused requests being served with an error code of 417 in
|
|
|
|
the logs and no delivery of postings from the contacts.
|
|
|
|
|
|
|
|
One can solve the issue by adding
|
|
|
|
|
|
|
|
server.reject-expect-100-with-417 = "disable"
|
|
|
|
|
2023-03-22 04:17:14 +01:00
|
|
|
to the lighttpd configuration file (e.g. in the beginning with the
|
2016-07-13 09:33:28 +02:00
|
|
|
other 'server.xxx' settings.
|
|
|
|
|
2013-03-03 00:46:54 +01:00
|
|
|
---------------( config starts )-----------------
|
|
|
|
|
|
|
|
debug.log-request-handling = "disable"
|
|
|
|
debug.log-condition-handling = "disable"
|
|
|
|
|
|
|
|
server.modules = (
|
|
|
|
"mod_access",
|
|
|
|
"mod_alias",
|
|
|
|
"mod_compress",
|
|
|
|
"mod_redirect",
|
|
|
|
"mod_fastcgi",
|
|
|
|
"mod_rewrite"
|
|
|
|
)
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
2014-09-20 11:41:44 +02:00
|
|
|
# enable SSL
|
2013-03-03 00:46:54 +01:00
|
|
|
ssl.engine = "enable"
|
|
|
|
ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
|
|
|
|
ssl.ca-file = "/etc/lighttpd/ssl/ca.pem"
|
|
|
|
|
2014-09-20 11:41:44 +02:00
|
|
|
# fix for problem between curl and lighttpd
|
|
|
|
server.reject-expect-100-with-417 = "disable"
|
|
|
|
|
2016-07-13 09:33:28 +02:00
|
|
|
# Send everybody to landing page:
|
2013-03-03 00:46:54 +01:00
|
|
|
$SERVER["socket"] == ":80" {
|
|
|
|
|
|
|
|
$HTTP["scheme"] == "http" {
|
|
|
|
$HTTP["host"] =~ ".*" {
|
2016-07-13 09:33:28 +02:00
|
|
|
# This next redirect doesn't appear to ever execute in Firefox
|
|
|
|
# (sometimes, anyway -- caching issue?), but it does seem to
|
|
|
|
# reliably in Google's Chromium browser. If I change it here
|
|
|
|
# and restart Lighty, Firefox still goes to the URL in the
|
|
|
|
# last 'else' below. Or something.
|
2014-09-20 11:41:44 +02:00
|
|
|
Sometimes.
|
2013-03-03 00:46:54 +01:00
|
|
|
server.document-root = "/var/www"
|
|
|
|
url.redirect = (".*" => "https://example.com")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else $SERVER["socket"] == ":443" {
|
|
|
|
|
|
|
|
$HTTP["scheme"] == "https" {
|
|
|
|
|
|
|
|
$HTTP["host"] == "wordpress.example.com" {
|
|
|
|
server.document-root = "/var/www/wordpress"
|
|
|
|
ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
|
2016-07-13 09:33:28 +02:00
|
|
|
# include "wpmu-rewrites.conf"
|
2013-03-03 00:46:54 +01:00
|
|
|
url.rewrite-if-not-file = (
|
|
|
|
"^/(.*/)?files/$" => "/index.php",
|
|
|
|
"^/(.*/)?files/(.*)" => "/wp-includes/ms-files.php?file=$2",
|
|
|
|
"^(/wp-admin/.*)" => "$1",
|
|
|
|
"^/([_0-9a-zA-Z-]+/)?(wp-.*)" => "/$2",
|
|
|
|
"^/([_0-9a-zA-Z-]+/)?(.*\.php)" => "/$2",
|
|
|
|
"^/(.*)/?$" => "/index.php/$1"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
else $HTTP["host"] == "friendica.example.com" {
|
|
|
|
server.document-root = "/var/www/friendica"
|
|
|
|
ssl.pemfile = "/etc/lighttpd/ssl/friendica.pem"
|
2016-07-13 09:33:28 +02:00
|
|
|
# Got the following 'Drupal Clean URL'after Mike suggested trying
|
|
|
|
# something along those lines, from http://drupal.org/node/1414950
|
2013-03-03 00:46:54 +01:00
|
|
|
url.rewrite-if-not-file = (
|
2019-10-17 07:47:28 +02:00
|
|
|
"^\/([^\?]*)\?(.*)$" => "/index.php?pagename=$1&$2",
|
|
|
|
"^\/(.*)$" => "/index.php?pagename=$1"
|
2013-03-03 00:46:54 +01:00
|
|
|
)
|
2020-09-07 14:37:24 +02:00
|
|
|
$HOST["url"] =~ "^/bin/" {
|
|
|
|
url.access.deny ( "" )
|
|
|
|
}
|
2013-03-03 00:46:54 +01:00
|
|
|
}
|
|
|
|
else $HTTP["host"] !~ "(friendica.example.com|wordpress.example.com)" {
|
|
|
|
server.document-root = "/var/www/wordpress"
|
|
|
|
ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
|
|
|
|
url.redirect = (".*" => "https://wordpress.example.com/main/")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
index-file.names = ( "index.php", "index.html",
|
|
|
|
"index.htm", "default.htm",
|
|
|
|
"index.lighttpd.html" )
|
|
|
|
|
|
|
|
url.access-deny = ( "~", ".inc" )
|
|
|
|
|
|
|
|
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
|
|
|
|
|
|
|
|
include_shell "/usr/share/lighttpd/use-ipv6.pl"
|
|
|
|
|
|
|
|
dir-listing.encoding = "utf-8"
|
|
|
|
server.dir-listing = "disable"
|
|
|
|
|
2016-07-13 09:33:28 +02:00
|
|
|
#compress.cache-dir = "/var/cache/lighttpd/compress/"
|
|
|
|
#compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/p\lain" )
|
2013-03-03 00:46:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
|
|
|
|
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
|
|
|
|
|
2014-09-20 11:41:44 +02:00
|
|
|
---------------( config ends )-----------------
|