Table of Contents

Reverse HTTPS Proxy with lighttpd

Original page

Install lighttpd and openssl

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install lighttpd
sudo apt-get install openssl

Generate certificate

sudo mkdir /etc/lighttpd/certs
sudo openssl req -new -x509 -keyout /etc/lighttpd/certs/lighttpd.pem -out /etc/lighttpd/certs/lighttpd.pem -days 365 -nodes
sudo chmod 400 /etc/lighttpd/certs/lighttpd.pem

Configure lighthttpd

Edit the lighttpd.conf file:

sudo nano /etc/lighttpd/lighttpd.conf

In server.modules section add a new line:

"mod_proxy",

At the end of the file add the complete block:

$SERVER["socket"] == "0.0.0.0:5557" {
     proxy.server  = ( "" =>
        (( "host" => "0.0.0.0", "port" => 8765 ))
    )
    ssl.engine = "enable"
    ssl.pemfile = "/etc/lighttpd/certs/lighttpd.pem"
}
sudo service lighttpd restart

Check if lighttpd restarted correctly:

sudo journalctl -xn