Apache to Lighttpd

GEMCC used Ask the Experts™

I have Apache running on an existing Linux server and am in the process of replacing.  How do I translate/convert the following from Apache to Lighttpd:

<VirtualHost *:80>
ServerName domain.com
ProxyPreserveHost On
ProxyPass /
ProxyPassReverse /
Redirect permanent / https://www.domain.com/

Open in new window

Please advise.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


I don't understand.
Distinguished Expert 2017

Have ltried searching for "Lighthttpd as a reverse proxy"
There are many examples.

Squid might be a better option,  

you are defining a proxy YET YOU ARE REDIRECTING all requests to a secure connection.

Dies the application behind the reverse proxy hard odes the ip from the request, I.e. Access by way of means the app response includes that as base href/or complete URL reference in the objects within as the reason for the URL conversions.


I regret you are talking over my head.

Maybe this is better:

I am using a router that has Lighttpd installed.  I am wanting to direct URL requests to go to various servers.  Some will have different port numbers and some will redirect to HTTPS (for example)
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Distinguished Expert 2017

Here are some lighttpd how tos http://redmine.lighttpd.net/projects/lighttpd/wiki/HowTos

The virtualhost for port 80 you posted is a straight redirect.
There is no need to include proxy parameters.
From the refirect example in the lighttpd
$HTTP["scheme"] == "http" {
    # capture vhost name with regex conditiona -> %0 in redirect pattern
    # must be the most inner block to the redirect rule
    $HTTP["host"] =~ ".*" {
        url.redirect = (".*" => "https://%0$0")

You would want the proxy configuration on the secure, 443 port, in your Apache config those are under the /etc/httpd/conf.d
DSL.conf or you gave a domain.conf that includes the
<virtualhost *:443>
serverName domain.com
Sslengine on
Cert .........
the proxying portion examples including reverse-proxy are referenced on http://redmine.lighttpd.net/projects/1/wiki/Docs_ModProxyCore
Note, you need to apply the proxying on https not http.
My advice is that you test one at a time, first configure the redirect and test it first.


I am still not understanding.  I put the following in lighttpd.conf:

$HTTP["host"] =~ "(domain.com)" {
        proxy.server = ( "" => ( (
                "host" => "",
                "port" => 80

Open in new window

If I understand domain.com should go to, correct?
Distinguished Expert 2017
the example in the link for reverse-proxy

Is and presumes you've enabled the required mod_proxy...
Snippet from http://redmine.lighttpd.net/projects/1/wiki/Docs_ModProxyCore

  server.modules  += ( "mod_proxy_backend_http" )
  $HTTP["url"] =~ "^(/|$)" {
    proxy-core.balancer = "round-robin" 
    proxy-core.protocol = "http" 
    proxy-core.backends = ( "www.domain.com" )
    proxy-core.rewrite-response = (
      "Location" => ( "^http://www.domain.com/(.*)" => "$1" ),
    proxy-core.rewrite-request = (
      "_uri" => ( "^/proxyme/?(.*)" => "/$1" ),
      "Host" => ( ".*" => "www.domain.com ),

Open in new window


Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial