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.
Apache Web ServerLinuxWeb Servers

Avatar of undefined
Last Comment
GEMCC

8/22/2022 - Mon
GEMCC

ASKER
I don't understand.
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.
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)
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
arnold

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.
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
arnold

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
GEMCC

ASKER
Thank you.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.