0

On my index.html page I have <img src="static_content/asf_logo.png">. I put the image into Apache24/htdocs/static_content.

I configured httpd.conf to have an acess to localhost/basic-application-web.

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkMount /basic-application-web/* worker1

I can access it fine however it does not display the image.

http://localhost/basic-application-web/static_content/asf_logo.png

Return 404. How to provide image to the page?

I was trying to do like this

<VirtualHost *:80>
    DocumentRoot htdocs/
    <Directory htdocs>
        Options +Indexes
        AllowOverride None
        Allow from all
    </Directory>
    JkMount /basic-application-web/* worker1
</VirtualHost>

But it changed nothing

2 Answers 2

0

Since the JkMount directive you have forwards the whole /basic-application-web directory to Tomcat, when a request is made for the static image URL, it will be forwarded to Tomcat, thus you get a 404.

You need to unmount the static content directory from mod_jk, by adding the following line after the JkMount ... line:

JkUnMount /basic-application-web/static-content/* worker1
0

I resolved the issue like this. In httpd.conf I left only these lines

LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties

VirtualHost past started to look like this

<VirtualHost *:80>
    DocumentRoot "${SRVROOT}/htdocs"
    <Directory "${SRVROOT}/htdocs/static_content">
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
    </Directory>
    JkMount /basic-application-web/ worker1
</VirtualHost>

Additionally I adjusted html page with path to image by adding aditional / before image path

<img src="/static_content/asf_logo.png">

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .