lighttpd as proxy

From WebHostingNeeds.com
Jump to: navigation, search

lighttpd can be used as proxy to load balance between multiple servers.

Today on a cpanel server, i moved web site to another web server. Since dns is cached, visitors still go to old IP, so i installed lighttpd on that server, configured as proxy, so it will transfer all request to new server.

I have install lighttpd as usual.

Then edit configuration file

vi /etc/lighttpd/lighttpd.conf


find

#                               "mod_proxy",

Replace with

#                               "mod_proxy",


Find

#proxy.server               = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "host" => "192.168.0.101",
#                                   "port" => 80
#                                 )
#                               )
#                             )

Below of after add

proxy.server               = ( "/" =>
                               ( "remote" =>
                                 (
                                   "host" => "174.36.192.112",
                                   "port" => 80
                                 )
                               )
                             )


Here 174.36.192.112 is new server IP.