Clay Banks
Clay Banks

Reputation: 4581

Serving Static Content on an Application Server

Suppose there is an Apache Web Server Connected to a Tomcat Application Server setup on a physical machine somewhere in a galaxy far, far away

This Web Server holds all static content inside of a folder under htdocs, let's say /htdocs/my-jedi-content

I want to mimic this behavior on my local machine using only Tomcat's app server.

Where can I place /my-jedi-content in the Tomcat directory so that my applications can pick up said static content as if it were sitting on a web server?

Upvotes: 1

Views: 316

Answers (1)

Jeff Storey
Jeff Storey

Reputation: 57162

You can add an entry in server.xml to point to the static content.

<Host appBase="webapps" autoDeploy="false" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false">

  <Context docBase="/home/stuff" path="/static" />

</Host>

Full explanation http://www.moreofless.co.uk/static-content-web-pages-images-tomcat-outside-war/ (snippet taken from this site).

Upvotes: 2

Related Questions