2

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?

user36022
  • 43
  • 7

3 Answers3

1

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.

joschi
  • 21,387
  • 3
  • 47
  • 50
0

Try changing these lines in apache:

ProxyPass /images http://127.0.0.1:82/
ProxyPass /imagehosting http://127.0.0.1:82/
ProxyPass /pictures http://127.0.0.1:82/
ProxyPassReverse / http://127.0.0.1:82/
h0tw1r3
  • 2,776
  • 19
  • 17
  • Unfortunately, it does not help. The whole site is served right - apart from images. It seems to me that the problem with the paths - so if lighttpd not seen them in a good way. Just do not know where I make a mistake. – user36022 Feb 27 '10 at 12:48
0

I don't understand why your lighttpd.config has:

server.document-root       = "/www/"

Shouldn't that be the same as Apache?

server.document-root       = "/www/MYAPP/forum/"

Or am I missing something?

Also you probably want to remove the alias.url entry for images, as that will break things, too.

fission
  • 3,601
  • 2
  • 21
  • 31