lighttpd.conf support http/https at the same time

173 Views Asked by At

my router's captive portal login page is deployed in 192.168.1.1:6789 and router can setup http or https in web UI.

I can't find a way to support both http and https at a same time.

This is my original lighttpd.conf file:

$SERVER["socket"] == "192.168.1.1:6789" {
#    ssl.engine = "enable"
#    ssl.pemfile = "/tmp/server.pem"
    server.document-root = "/tmp/"
    fastcgi.server += ( ".php" =>
                    ((
                        "bin-path" => "/usr/bin/php-cgi",
                        "socket" => "/var/run/php7-fpm.sock",
                        "max-procs" => 1,
                        "idle-timeout" => 20,
                        "bin-environment" => ( "PHP_FCGI_CHILDREN" => "1", "PHP_FCGI_MAX_REQUESTS" => "10000" ),
                        "broken-scriptfilename" => "enable"
                    ))
                  )
}

It might look weird, but I wanted to use the sed command to change ssl.engine and ssl.pemfile before.

However, I realized that I cannot dynamically modify lighttpd.conf because after modifying it, I would need to restart the lighttpd server, which would also cause the router's WUI to stop.

I tried the following configuration:

$SERVER["socket"] == "192.168.1.1:6789" {
    $HTTP["scheme"] == "https" {    
        ssl.engine = "enable"        
        ssl.pemfile = "/tmp/server.pem"
    }
    server.document-root = "/tmp/"
    fastcgi.server += ( ".php" =>
                    ((
                        "bin-path" => "/usr/bin/php-cgi",
                        "socket" => "/var/run/php7-fpm.sock",
                        "max-procs" => 1,
                        "idle-timeout" => 20,
                        "bin-environment" => ( "PHP_FCGI_CHILDREN" => "1", "PHP_FCGI_MAX_REQUESTS" => "10000" ),
                        "broken-scriptfilename" => "enable"
                    ))
                  )
}

but it will show validation failed.

0

There are 0 best solutions below