# Problem with images on Apache and Lighttpd

**URL:** <https://www.ruby-forum.com/t/problem-with-images-on-apache-and-lighttpd/62440>\
**Category:** Rails\
**Created:** [June 4, 2006, 9:42pm UTC](https://www.ruby-forum.com/t/problem-with-images-on-apache-and-lighttpd/62440 "2006-06-04T21:42:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hans-dampf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/85e7bf/32.png) [@hans-dampf](https://www.ruby-forum.com/u/hans-dampf)\
**Post date:** [June 4, 2006, 9:42pm UTC](https://www.ruby-forum.com/t/problem-with-images-on-apache-and-lighttpd/62440/1 "2006-06-04T21:42:24Z")

</div>

Hello.

Since two days I am trying to set up two rails-apps on a vserver-host so  
that I can access from work 😉  
I tried all I can imagine and what Google/MSN teached me: FastCGI, SCGI,  
Lighttpd, Apache, Alias, Vhosts,…  
But nothing really works. I am on Debian 3.1 with Ruby 1.8.4, Rails  
1.1.2, FastCGI 2.4.0, mod\_fastcgi 2.4.2, ruby\_fcgi 0.8.6, ruby\_gems  
0.8.11, Apache 2.0.54, Lighttpd 1.4.11

At last I was really near my favorite solution. So that I can reach:  
[http://my.server.net/BlackJax](http://my.server.net/BlackJax)  
[http://my.server.net/tracks](http://my.server.net/tracks)

But both Apache AND Lighttpd showed the same problem: Images (and  
partly) Stylesheets are not shown. The technique as such works fine.  
Interesting: Both show the same errors (example from lighttpd-log,  
apache shows the equivalent):  
2006-06-04 20:57:10: (response.c.451) – handling physical path  
2006-06-04 20:57:10: (response.c.452) Path :  
/var/www/images/deck/2d.gif  
2006-06-04 20:57:10: (response.c.492) – file not found

I am using Fastcgi/Fcgid while getting this error, SCGI seemed even  
messier to me (I only tried SCGI with Apache). For whatever reason it  
seems that images are not taken from the (i.e.)  
/opt/railsapps/BlackJax/public-folder, but from the servers doc-root.  
btw: I did not miss to put  
ActionController::AbstractRequest.relative\_url\_root = “/Blackjax”  
at the end of environment.rb, I also checked .htaccess

## Here the important part of my lighttp.conf:

server.port = 80  
server.modules = (“mod\_alias”, “mod\_rewrite”,  
“mod\_accesslog”, “mod\_fastcgi” )  
server.document-root = “/var/www/”  
url.rewrite = ( “^/$” =\> “index.html”, “^([^.]+)$” =\>  
“$1.html” )

$HTTP[“url”] =~ “^/BlackJax” {  
server.document-root = “/opt/railsapps/BlackJax/public/”  
alias.url = ( “/BlackJax” =\> “/opt/railsapps/BlackJax/public” )  
server.error-handler-404 = “/dispatch.fcgi”  
server.errorlog =  
“/opt/railsapps/BlackJax/log/lighttpd.error.log”  
accesslog.filename =  
“/opt/railsapps/BlackJax/log/lighttpd.access.log”  
server.indexfiles = ( “dispatch.fcgi”, “index.html” )

## fastcgi.server = ( “.fcgi” =\> (( “socket” =\> “/opt/railsapps/BlackJax/log/code.socket”, “min-procs” =\> 2, “max-procs” =\> 2, “bin-path” =\> “/opt/railsapps/BlackJax/public/dispatch.fcgi”, “bin-environment” =\> ( “RAILS\_ENV” =\> “development” ) ))) }

## And here the important part of my http.conf:

NameVirtualHost \*:80  
FastCgiServer /var/www/BlackJax/public/dispatch.fcgi -initial-env  
RAILS\_ENV=development -processes 1 -idle-timeout 60  
VirtualHost \*\>  
ServerName [my.server.net](http://my.server.net)  
DocumentRoot /var/www/

## RewriteCond %{REQUEST\_URI} !^/BlackJax/public RewriteRule ^/BlackJax(/.\*)?$ /BlackJax/public$1 \<Directory /var/www/BlackJax/public/\> #ErrorLog /var/www/BlackJax/log/error.log #CustomLog /var/www/BlackJax/log/access.log combined SetEnv RAILS\_ENV development AddHandler fcgid-script .fcgi Options ExecCGI FollowSymLinks AllowOverride all Allow from all Order allow,deny

I also tried to take away the rewrite-directives, but without success. I  
am lost now… The only solution I can see would be to start two  
lighttpd on different ports, cause that works ☹

any help is appreciated!

Best regards,

hans-dampf

---

<div class="post-metadata">

**Author:** ![hans-dampf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/85e7bf/32.png) [@hans-dampf](https://www.ruby-forum.com/u/hans-dampf)\
**Post date:** [June 10, 2006, 8:52am UTC](https://www.ruby-forum.com/t/problem-with-images-on-apache-and-lighttpd/62440/2 "2006-06-10T08:52:24Z")

</div>

Does nobody have an idea?

Thanks in advance

Hans Dampf
