-
Notifications
You must be signed in to change notification settings - Fork 564
Document lighttpd configuration example from matrix.jaxlug.ngo #19875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Document lighttpd reverse proxy configuration example from matrix.jaxlug.ngo, a contribution from the JaxLUG, the Jacksonville Linux Users Group Inc.. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,10 @@ It is recommended to put a reverse proxy such as | |
| [nginx](https://nginx.org/en/docs/http/ngx_http_proxy_module.html), | ||
| [Apache](https://httpd.apache.org/docs/current/mod/mod_proxy_http.html), | ||
| [Caddy](https://caddyserver.com/docs/quick-starts/reverse-proxy), | ||
| [HAProxy](https://www.haproxy.org/) or | ||
| [relayd](https://man.openbsd.org/relayd.8) in front of Synapse. | ||
| [HAProxy](https://www.haproxy.org/), | ||
| [relayd](https://man.openbsd.org/relayd.8) or | ||
| [lighttpd](https://www.lighttpd.net/) | ||
| in front of Synapse. | ||
| This has the advantage of being able to expose the default HTTPS port (443) to Matrix | ||
| clients without requiring Synapse to bind to a privileged port (port numbers less than | ||
| 1024), avoiding the need for `CAP_NET_BIND_SERVICE` or running as root. | ||
|
|
@@ -312,6 +314,73 @@ relay "matrix_federation" { | |
| } | ||
| ``` | ||
|
|
||
| ### lighttpd | ||
| ```conf | ||
| server.modules = ( | ||
| "mod_rewrite", | ||
| "mod_redirect", | ||
| "mod_access", | ||
| "mod_setenv", | ||
| "mod_openssl", | ||
| "mod_proxy", | ||
| "mod_accesslog" | ||
| ) | ||
|
|
||
| server.username = "lighttpd" | ||
| server.groupname = "lighttpd" | ||
|
|
||
| # leave commented out for proper IPv6 see below IPv4 0.0.0.0 & IPv6 [::] | ||
| #server.use-ipv6 = "enable" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is intended as "you can use IPv6 if you want!" comment, could you add a line saying so? Otherwise it comes across as dead code/accidentally left in.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added comment, you want to ensure that is commented out. |
||
|
|
||
| ssl.pemfile = "/etc/lighttpd/cert+privkey.pem" | ||
| ssl.ca-file = "/etc/lighttpd/fullchain.pem" | ||
|
|
||
| $SERVER["socket"] == "0.0.0.0:80" { } | ||
| $SERVER["socket"] == "0.0.0.0:443" { ssl.engine = "enable" } | ||
| $SERVER["socket"] == "0.0.0.0:8448" { ssl.engine = "enable" } | ||
| $SERVER["socket"] == "[::]:80" { } | ||
| $SERVER["socket"] == "[::]:443" { ssl.engine = "enable" } | ||
| $SERVER["socket"] == "[::]:8448" { ssl.engine = "enable" } | ||
|
|
||
| # both lighttpd and synapse need permissions for socket r/w | ||
| $HTTP["url"] =~ "(/_matrix|_synapse/admin|/_synapse/client)" { | ||
| proxy.balance = "hash" | ||
| proxy.server = ( | ||
| "" => ( | ||
| "backend-socket" => ( | ||
| "host" => "/var/lib/synapse/main_public.sock", | ||
| "port" => 0 | ||
| ) | ||
| ) | ||
| ) | ||
| proxy.forwarded = ( | ||
| "for" => 1, | ||
| "proto" => 1, | ||
| "host" => 1, | ||
| ) | ||
| } | ||
| # protect admin access IPv6 ULA only | ||
| $HTTP["remoteip"] !="fd00::/8" { | ||
| $HTTP["url"] =~ "^/_synapse/admin/" { | ||
| url.access-deny = ( "" ) | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| [Delegation](delegate.md) example: | ||
| ```conf | ||
| url.rewrite-once = ( | ||
| "^/\.well-known/matrix/client$" => "/.well-known/matrix/client.json", | ||
| "^/\.well-known/matrix/server$" => "/.well-known/matrix/server.json" | ||
| ) | ||
|
|
||
| # This condition intentionally matches the post-rewrite URLs. | ||
| $HTTP["url"] =~ "^/\.well-known/matrix/(client|server)\.json$" { | ||
| mimetype.assign = ( ".json" => "application/json" ) | ||
| setenv.set-response-header = ( "Access-Control-Allow-Origin" => "*" ) | ||
| } | ||
| ``` | ||
|
|
||
|
|
||
| ## Health check endpoint | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.