I'm running a fresh install of Raspbian Stretch Lite. I've done apt-get update and apt-get upgrade.
I want to set up a reverse proxy in order to use another webserver (PlexConnect) at port 80 at the same RPi server as Pi-hole. Both webservers normally use port 80. However, I've set up PlexConnect to listen to port 8080. My goal is to make requests to trailers.apple.com port 80 to be "forwarded" to the PlexConnect webserver at port 8080.
I'm a beginner, but as far as I understand a part of the solution is to add a proxy server to the /etc/lighttpd/external.conf.
This is my code:
server.modules += ( "mod_proxy" )
$HTTP["host"] == "trailers.apple.com" {
proxy.server = ( "/" => ( (
"host" => "127.0.0.1",
"port" => 8080
) ) )
}
However, this code doesn't work.
$ sudo service lighttpd reload
[FAIL] Reloading web server configuration: lighttpd failed!
$ lighttpd -v
lighttpd/1.4.45 (ssl) - a light and fast webserver
Build-Date: Jan 14 2017 21:07:19
$ sudo tail /var/log/lighttpd/error.log
2019-03-25 10:33:03: (server.c.1828) server stopped by UID = 0 PID = 19231
2019-03-25 10:33:03: (log.c.217) server started
2019-03-25 10:33:03: (server.c.1295) WARNING: unknown config-key: proxy.server (ignored)
However this most likely will not work as you expect. http://trailers.apple.com may be able to be intercepted and redirected, but apple uses TLS and https://trailers.apple.com can not be impersonated without distributing your own certificates and certificate authority.
$ sudo /usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
2019-03-25 11:40:06: (plugin.c.187) Cannot load plugin mod_proxy more than once, please fix your config (lighttpd may not accept such configs in future releases)
Regarding TLS: I have followed this guide Install Guide Mac Certificates · iBaa/PlexConnect Wiki · GitHub to generate certificates. They are now found in /usr/local/lib/PlexConnect/trailers.cer and /usr/local/lib/PlexConnect/trailers.pem. But I'm not sure how to make lighttpd use them. I'm guessing I will have to make a separate entry in /etc/lighttpd/external.conf for port 443?