Apache2 with lighttpd as proxy

apache-2.2lighttpdPROXY

I am using apache2 as web server. I would like to help him lighttpd as a proxy for static content. Unfortunately I can not well set up lighttpd and apache2. (OS: Debian)

Important things from lighttpd.config:

server.modules              = ( 
            "mod_access",
            "mod_alias",
            "mod_accesslog",
        "mod_proxy",
        "mod_status",
 )


server.document-root       = "/www/"
server.port               = 82
server.bind                = "localhost"

$HTTP["remoteip"] =~ "127.0.0.1" {
    alias.url += ( 
        "/doc/" => "/usr/share/doc/",
        "/images/" => "/usr/share/images/"
    )
    $HTTP["url"] =~ "^/doc/|^/images/" {
        dir-listing.activate = "enable"
    }
}

I would like to use lighttpd in only one site operating as a virtual directory on apache2.
Configuration of this virtual directory:

ProxyRequests Off
ProxyPreserveHost On
ProxyPass /images http://0.0.0.0:82/
ProxyPass /imagehosting http://0.0.0.0:82/
ProxyPass /pictures http://0.0.0.0:82/
ProxyPassReverse / http://0.0.0.0:82/

ServerName MY_VALUES
ServerAlias www.MY_VALUES
UseCanonicalName Off
DocumentRoot /www/MYAPP/forum
<Directory "/www/MYAPP/forum">
DirectoryIndex index.htm index.php
    AllowOverride None 

As you can see (or not;)) my service is physically located at the path:

/ www / myapp / forum

and I would like to support lighttpd dealt with folders:

/ www / myapp / forum / images
/ www / myapp / forum / imagehosting
/ www / myapp / forum / pictures

and left the rest (PHP scripts) for apache

After running lighttpd and apache2 working party, but did not show up any images of these locations. What is wrong?

Best Answer

IMHO your created your configuration the wrong way. With your configuration, lighttpd is proxied by Apache httpd, which doesn't make much sense since your objective was utilizing the (supposedly) better performance of lighttpd.

So bind Apache httpd to another port and interface (e. g. 127.0.0.1:8080) and let lighttpd's mod_proxy do the dirty work.

See http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModProxy for configuration examples of mod_proxy for lighttpd.

Related Topic