How ro serve static contents from apache

Alles, was den Apache betrifft, kann hier besprochen werden.

How ro serve static contents from apache

Postby vikram115 » 21. July 2015 13:03

Hi All,

I am new to apache and trying to figure out a way in which i can send all the static content from apache rather than from application server. Currently i have one weblogic admin on where i am hosting my application and using Apache 2.2. I tried below configuration but nothing seems to be working.

Code: Select all
<Location /hello>
    SetHandler weblogic-handler
    WLExcludePathOrMimeType *.json,*.html,*.png,*.jpg,*.css,images/*.jpg   
</Location>
<IfModule mod_weblogic.c>
    WebLogicHost localhost
    WebLogicPort  7844
    HungServerRecoverSecs 3600
    ConnectTimeoutSecs 25
    ConnectRetrySecs 2
    Debug OFF
</IfModule>


As per my understaning the above code will skip searching for these static files from weblogic app server and will see it from apach root directory which is currently set as Htdoc which is defualt in case of windows. However nothing is being picked up when i am putting these static files there. I know there must be better solution than this. Can someone please guide me on this issue.

Thanks
Vikram
vikram115
 
Posts: 3
Joined: 21. July 2015 12:53
Operating System: windows

Re: How ro serve static contents from apache

Postby Nobbie » 21. July 2015 13:30

I have no idea what "weblogic" is and what you are doing there. But if you specify

Code: Select all
<Location /hello>


in your config, this configuration is NOT valid for DocumentRoot, but for the URL which contains /hello, for example http://myserver/hello/picture.jpg
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: How ro serve static contents from apache

Postby vikram115 » 21. July 2015 13:36

Thanks for the reply Nobbie. Actually weblogic is an application server in which i have kept my war file. That war file consist of all the static content like images.js etc. Now i don't want the request to go to application server for accessing these static content. I want to put all these static content in apache server so that when i hit the url the request comes to apache for seving these static content.

So basically when i search htto://localhost:8080/hello/images/image.png this should be picked up from apache rather than from the application server.

So could you please let me know what can i do to achieve the same. :( :(
vikram115
 
Posts: 3
Joined: 21. July 2015 12:53
Operating System: windows

Re: How ro serve static contents from apache

Postby Nobbie » 21. July 2015 14:25

vikram115 wrote:So could you please let me know what can i do to achieve the same. :( :(


Sorry, I cannot. I dont know anything about weblogic and dont now how Apache and weblogic are working together.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: How ro serve static contents from apache

Postby vikram115 » 21. July 2015 14:50

No Issues Nobbie. However i just need to know how any url read things from document root. Do i need to add images,javascript etc folder in document root. What configuration can i do such that url http://localhost:8080/hello/images/vik.txt will pick this /images/vik.img from document root .
vikram115
 
Posts: 3
Joined: 21. July 2015 12:53
Operating System: windows

Re: How ro serve static contents from apache

Postby Nobbie » 21. July 2015 17:15

vikram115 wrote:What configuration can i do such that url http://localhost:8080/hello/images/vik.txt will pick this /images/vik.img from document root .


Add an Alias to your configuration:

Code: Select all
Alias /hello c:/xampp/htdocs
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 191 guests