I need apache to serve images from localhost instead of appserver

I have an apache/2.2.15 server centos 6.3
The apache server will be serving jboss app via mod_proxy (got that working)
But... I need to serve the images from a local directory on the apache server. Here is my configuration. When I got to the site, I get 404s for all the images.

What am I doing wrong?

<VirtualHost *:80>


ServerAdmin admim@admin.com
ServerName atg10deva.somedomain.com/
ServerAlias atg10deva
DocumentRoot    /home/atg/www/

ProxyPass / http://atg10deva-app02:8280/
ProxyPassReverse / http://atg10deva-app02:8280/
ProxyPreserveHost On
ProxyPassReverseCookiePath / /

Alias /images/ /home/atg/www/svn/images/catalog
<Directory /home/atg/www/svn/images/>
          Options Indexes FollowSymLinks
        AllowOverride none
        Order allow,deny
        Allow from all
</Directory>



ErrorLog logs/atg10deva-app02-error_log
CustomLog logs/atg10deva-app02-access_log combined
</VirtualHost>

Not an apache guru, but it looks like / is proxied through, which hides /images/ Others have tried and nobody offered a solution: virtualhost - How to set up a proxy location for all paths except some with apache2? - Stack Overflow

I think conceptualy, using apache as a proxy is very divorced from using apache as a server. It usually does mostly one or the other on any port.

1 Like

This is a guess but try putting your alias and images directory directive before your proxypass stuff.

1 Like

Either that or put you local files on an odd second port server, so there is no confusion. Someone has to make URLs to hook them to the web, so they can put port numbers in the URL. Every system comes with 65536 TCP ports.

1 Like

as suggested by glev2005, I did a combination of your suggestions. here is what worked for me.

above all the entries, the first one should have been..

ProxyPass /images/ !
ServerAdmin admim@admin.com
ServerName atg10deva.somedomain.com/
ServerAlias atg10deva
DocumentRoot    /home/atg/www/

ProxyPass /images/ !
ProxyPass / http://atg10deva-app02:8280/
ProxyPassReverse / http://atg10deva-app02:8280/
ProxyPreserveHost On
ProxyPassReverseCookiePath / /

Alias /images/ /home/atg/www/svn/images/catalog
<Directory /home/atg/www/svn/images/>
          Options Indexes FollowSymLinks
        AllowOverride none
        Order allow,deny
        Allow from all
</Directory>



ErrorLog logs/atg10deva-app02-error_log
CustomLog logs/atg10deva-app02-access_log combined
</VirtualHost>

I suppose if you have a 100% read only and final file set, you could write or find a specialized web server that accepted only dumb GET and pulls the files from preestablished mmap64() areas looked up in a hash map. The overhead would be very low. It could be a thread per socket app, writing with blocking I/O, with the write socket buffers all set to 1-2 pages to keep wired RAM use down.

I suppose that when a file needs to be changed, and migh be a different size, you would need to do that that and not interrupt service. The old file could be deleted, the new file copied, a new mmap made, the new location and size updated into the hash map and when all old transmissions of that file end, the old space unmapped. When you optimize for static, change is a pain!