Results 1 to 6 of 6

Thread: Serving Static Content

  1. #1
    Join Date
    Aug 2009
    Posts
    3

    Question Serving Static Content

    Can someone describe the process of setting up the TServer (or Tomcat server) to delegate the serving of static content to Apache?

    What configuration is required in the http.conf?

    Thanks,

    Paul.

  2. #2
    Join Date
    Jun 2005
    Posts
    102

    Default

    Paul,

    When you define the application (in addition to providing war file(s) ) you supply a zip/tar of the static content files. Those files are then served by Apache. Requests to /myChosenContextRoot are proxied to the app server.

    Chris

  3. #3
    Join Date
    Aug 2009
    Posts
    3

    Default

    Thanks Chris.

    What if my application is in the ROOT context? How does apache know to serve the static content?

    Wouldn't I need to put some 'ignore' in the http.conf so that the static folder bypasses tomcat? If so, what would I need to add?

    Regards,

    Paul.

  4. #4

    Default

    You want to use mod_jk for your apache httpd server:

    http://en.wikipedia.org/wiki/Mod_jk

  5. #5
    Join Date
    Aug 2009
    Posts
    3

    Default

    As I understand it, Cloud Foundry does not use mod_jk but mod_proxy/mod_proxy_ajp.

    P.

  6. #6
    Join Date
    Sep 2005
    Posts
    7

    Default

    Hi Paul,

    While we're working on a better way to serve static content from Apache with a web application deployed to the ROOT context, here's a solution that will work in a single instance topology.

    Let's say you want to serve images and stylesheets from Apache, and your static.zip has /image and /css subdirectories

    Create the following script on your local machine (let's say script.sh):

    Code:
    cat > /etc/httpd/conf.d/_proxyexcludes.conf <<END
    ProxyPass /image !
    ProxyPass /css !
    END
    Now when you are launching your application, on the "Launch Deployment" page check the RUN SCRIPT checkbox under CONTAINER INITIALIZATION SCRIPT and select your script.sh in the file input labeled SCRIPT.

    The script will run on your instance prior to starting your app, and it will tell Apache to exclude /image and /css paths from being proxied to the app server.

    Hope this helps,

    Dmitriy Volk

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •