Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

142 lines
4.8 KiB

  1. Below is a sample config for Lighttpd that
  2. seems to work well on Debian Squeeze, with "lighttpd/1.4.28 (ssl)"
  3. The idea is: if someone enters the bare URL for my site, 'example.com',
  4. they get redirected to https://example.com/index.html, which is simply a
  5. page with two links on it: https://wordpress.example.com and
  6. https://friendica.example.com.
  7. If someone enters https://example.com, they get redirected to
  8. https://wordpress.example.com/main/, which is the 'main' blog in a Word
  9. Press 'network install' of the 'subdirectory' variety.
  10. I thought it might be nice to offer people who join my Friendica
  11. instance their own blogs, if they like.
  12. One can obtain free, signed, single subdomain SSL certificates from
  13. StartCom CA, which upon checking I noticed was already installed in both
  14. Firefox and Google Chromium. Info at http://cert.startcom.org/ . So I
  15. got one for each site, and have Lighty use the appropriate cert based on
  16. the requested URL.
  17. Enjoy!
  18. On Debian Jessie with lighttpd 1.4.35-4 there was a problem encountered
  19. between curl (which is used by Friendica in the background) and lighttp.
  20. This problem caused requests being served with an error code of 417 in
  21. the logs and no delivery of postings from the contacts.
  22. One can solve the issue by adding
  23. server.reject-expect-100-with-417 = "disable"
  24. to the lighttpd configuratiion file (e.g. in the beginning with the
  25. other 'server.xxx' settings.
  26. ---------------( config starts )-----------------
  27. debug.log-request-handling = "disable"
  28. debug.log-condition-handling = "disable"
  29. server.modules = (
  30. "mod_access",
  31. "mod_alias",
  32. "mod_compress",
  33. "mod_redirect",
  34. "mod_fastcgi",
  35. "mod_rewrite"
  36. )
  37. server.document-root = "/var/www"
  38. server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
  39. server.errorlog = "/var/log/lighttpd/error.log"
  40. server.pid-file = "/var/run/lighttpd.pid"
  41. server.username = "www-data"
  42. server.groupname = "www-data"
  43. # enable SSL
  44. ssl.engine = "enable"
  45. ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
  46. ssl.ca-file = "/etc/lighttpd/ssl/ca.pem"
  47. # fix for problem between curl and lighttpd
  48. server.reject-expect-100-with-417 = "disable"
  49. # Send everybody to landing page:
  50. $SERVER["socket"] == ":80" {
  51. $HTTP["scheme"] == "http" {
  52. $HTTP["host"] =~ ".*" {
  53. # This next redirect doesn't appear to ever execute in Firefox
  54. # (sometimes, anyway -- caching issue?), but it does seem to
  55. # reliably in Google's Chromium browser. If I change it here
  56. # and restart Lighty, Firefox still goes to the URL in the
  57. # last 'else' below. Or something.
  58. Sometimes.
  59. server.document-root = "/var/www"
  60. url.redirect = (".*" => "https://example.com")
  61. }
  62. }
  63. }
  64. else $SERVER["socket"] == ":443" {
  65. $HTTP["scheme"] == "https" {
  66. $HTTP["host"] == "wordpress.example.com" {
  67. server.document-root = "/var/www/wordpress"
  68. ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
  69. # include "wpmu-rewrites.conf"
  70. url.rewrite-if-not-file = (
  71. "^/(.*/)?files/$" => "/index.php",
  72. "^/(.*/)?files/(.*)" => "/wp-includes/ms-files.php?file=$2",
  73. "^(/wp-admin/.*)" => "$1",
  74. "^/([_0-9a-zA-Z-]+/)?(wp-.*)" => "/$2",
  75. "^/([_0-9a-zA-Z-]+/)?(.*\.php)" => "/$2",
  76. "^/(.*)/?$" => "/index.php/$1"
  77. )
  78. }
  79. else $HTTP["host"] == "friendica.example.com" {
  80. server.document-root = "/var/www/friendica"
  81. ssl.pemfile = "/etc/lighttpd/ssl/friendica.pem"
  82. # Got the following 'Drupal Clean URL'after Mike suggested trying
  83. # something along those lines, from http://drupal.org/node/1414950
  84. url.rewrite-if-not-file = (
  85. "^\/([^\?]*)\?(.*)$" => "/index.php?pagename=$1&$2",
  86. "^\/(.*)$" => "/index.php?pagename=$1"
  87. )
  88. $HOST["url"] =~ "^/bin/" {
  89. url.access.deny ( "" )
  90. }
  91. }
  92. else $HTTP["host"] !~ "(friendica.example.com|wordpress.example.com)" {
  93. server.document-root = "/var/www/wordpress"
  94. ssl.pemfile = "/etc/lighttpd/ssl/wordpress.pem"
  95. url.redirect = (".*" => "https://wordpress.example.com/main/")
  96. }
  97. }
  98. }
  99. index-file.names = ( "index.php", "index.html",
  100. "index.htm", "default.htm",
  101. "index.lighttpd.html" )
  102. url.access-deny = ( "~", ".inc" )
  103. static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
  104. include_shell "/usr/share/lighttpd/use-ipv6.pl"
  105. dir-listing.encoding = "utf-8"
  106. server.dir-listing = "disable"
  107. #compress.cache-dir = "/var/cache/lighttpd/compress/"
  108. #compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/p\lain" )
  109. include_shell "/usr/share/lighttpd/create-mime.assign.pl"
  110. include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
  111. ---------------( config ends )-----------------