Link to home
Start Free TrialLog in
Avatar of GEMCC
GEMCC

asked on

Apache to Lighttpd

Hello,

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 / http://192.168.1.10/
ProxyPassReverse / http://192.168.1.10/
Redirect permanent / https://www.domain.com/
</VirtualHost>

Open in new window


Please advise.
Avatar of GEMCC
GEMCC

ASKER

I don't understand.
Avatar of arnold
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 192.168.1.10 means the app response includes that as base href/or complete URL reference in the objects within as the reason for the URL conversions.
Avatar of GEMCC

ASKER

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)
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.
Avatar of GEMCC

ASKER

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

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

Open in new window

If I understand domain.com should go to 192.168.128.10, correct?
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GEMCC

ASKER

Thank you.