0

I have a http server running on localhost:50001 and a ssl enabled server on localhost:50002, my root domain is say example.com lighttpd serves a directory when example.com is requested. I need to forward example.com:50001 and example.com:50002 to localhost:50001 and localhost:50002.

I am not able to achieve this, I tried config below

&HTTP["host"] == "example.com:50001" {
        proxy-core.backends = ("localhost:50001")
        }


$HTTP["host"] == "example.com" {
        server.document-root = "/var/www/servers/example.com"
        }

But that causes an error. I haven't tried configuring for ssl server.

Harwee
  • 101
  • The syntax you posted above appears to be for the unreleased and abandoned branch of lighttpd 1.5. Please see https://wiki.lighttpd.net/ and https://wiki.lighttpd.net/Docs_ModProxy for lighttpd 1.4 documentation. – gstrauss Jun 25 '22 at 03:11

1 Answers1

0

you should separate listener for localhost and external ip.

# in this config are only relevant parts listed
server.port = 50001
server.bind = "192.168.0.1"

$HTTP["host"] == "example.com:50001" {
    proxy-core.backends = ("localhost:50001")
    }

$SERVER["socket"] == "localhost:50001" {
    $HTTP["host"] == "example.com" {
            server.document-root = "/var/www/servers/example.com"
    }

I think you are producing a loop with your config.

Rainer
  • 314
  • 1
  • 4