Having problems enabling SSL on lighttpd installed on ASUSWRT router

1k views Asked by At

I have an ASUS RT-AC5300 router with Merlin firmware. I installed Entware on it, then followed this article to install lighttpd: Lighttpd-web-server-with-PHP-support-through-Entware
So the web server works fine through http, but after adding a section to the lighttpd.conf file, and trying to restart the web server, it doesn't start up.
This article: Enabling_https_via_SSL says that I need to add this section to the config file:

$SERVER["socket"] == ":443" {
  ssl.engine                  = "enable" 
  ssl.pemfile                 = "/opt/etc/lighttpd/certs/lighttpd.pem" 
}

After I added that section, but after restarting the web server it doesn't respond now on http either. The browser shows an error "ERR_CONNECTION_REFUSED".
I don't understand what $SERVER means in this config file. I have a feeling that it's a variable that is not defined in my case.
The certificate file .pem I created on my Mac, and placed into that directory.
I saw that in the case of Entware, the location of the original config file was at this location: "/opt/etc/lighttpd/lighttpd.conf" (there is an "/opt" in the front compared to the lighttpd Wiki page, and the /opt is the root folder of the USB stick plugged into the router.
My lighttpd version is 1.4.59:

admin@ASUS_Router:/tmp/home/root# lighttpd -v
lighttpd/1.4.59 (ssl) - a light and fast webserver

I would appreciate if anyone can help me with this.
Thanks.

1

There are 1 answers

6
gstrauss On

With recent versions of lighttpd, OpenWRT and derivatives have lighttpd-mod-openssl as a package separate from lighttpd. You probably need to opkg install lighttpd-mod-openssl

From a command line prompt, run lighttpd -tt -f /etc/lighttpd/lighttpd.conf or lighttpd -tt -f /opt/etc/lighttpd/lighttpd.conf in your case. This will pre-flight the lighttpd config and will likely give you details on your issue.