Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

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.

share|improve this answer

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/
share|improve this answer
    
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

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.