LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Image links showing 404 error on Apache (https://www.linuxquestions.org/questions/linux-newbie-8/image-links-showing-404-error-on-apache-4175456462/)

mlnm 04-02-2013 12:06 AM

Image links showing 404 error on Apache
 
Hi, i have redirected Apache to tomcat webapp using mod_proxy.The redirection was successful but when i open my my website and click on some images ,they show me 404 error saying "requested source is unavailable".On Apache website everything other links works fine but only images dont work.But when i open through tomcat, the images also work fine.
Cant find anything in logs regarding this.

Details:
Server : RHEL 5
Apache 2.2
Tomcat 7.0.37
Mysql 5.5
jdk ver : 7
Selinux : disabled

Any help would be greatly appreciated.
Thank you..

eklavya 04-02-2013 12:47 AM

Are you facing this problem for particular extention image like jpeg, gif, png or all types of image files.

When you type path of the image, does it open?
Code:

http://localhost/myproject/myimage.png
Are these lines are uncommented in your httpd.conf file
Code:

EnableMMAP off
EnableSendfile off

If not, made them uncommented and restart apache.

mlnm 04-02-2013 02:06 AM

1. These lines were commented in httpd.conf ,i uncommented them and restarted apache but doesn't work.
EnableMMAP off
EnableSendfile off

I have my website public you can check it : http://cypherlogics.com

Try clicking the images that rotate next to the main tabs.

eklavya 04-02-2013 05:11 AM

When I click on the CD image it goes on 404
http://cypherlogics.com/CypherLogics...lid=CID2345690

but if I click on home link, it opens the page.

You haven't replied my other questions of previous post.
Are you facing this problem for particular extention image like jpeg, gif, png or all types of image files?
When you type path of the image, does it open?
Code:

http://localhost/myproject/myimage.png
Have you defined this attribute in httpd.conf
Code:

AddType image/png png
AddType image/jpg jpg


mlnm 04-02-2013 05:27 AM

1.Yes ,images work fine through localhost on Tomcat.This is happening since the redirection was done.

2.All formats of images are not working.

3.I tried the following attributes but still doesn't work.
AddType image/png png
AddType image/jpg jpg

Thanks for your reply..

mlnm 04-02-2013 11:31 PM

My problem has been solved ,i tried the 301 redirect instead of mod_proxy and now all images working fine and links are also working fine.

But i have a small problem,while redirecting ,the url shows the 8080 port publicly,i dont want to show that ,could you please tell me how can i mask that port?

I tried masking through mod_rewrite but didn't work out.

Thank you..

eklavya 04-02-2013 11:49 PM

You means it shows port name with your domain name?
because if it shows with localhost like http://localhost:8080
That is how the browsers work. They assume port 80 for http unless you specify a different port. If you specify different port, then the port number must be specified in the url.

But if it shows with domain name then this is a problem, confirm first.

mlnm 04-03-2013 02:22 AM

I have used the following code in httpd.conf

<VirtualHost *:80>
ServerName cypherlogics.com
ServerAlias www.cypherlogics.com
Redirect 301 / http://cypherlogics.com:8080/CypherLogics/
</VirtualHost>

i tried Redirect 301 / http://cypherlogics.com/CypherLogics/ but it didn't work.

when i go to http://www.cypherlogics.com ,it shows url like this http://cypherlogics.com:8080/CypherL...hannelsServlet

Previously when i was doing redirection through proxy,this was not happening but as you know i had problem with images in that so i removed it and applied the code in the virtual host.

eklavya 04-03-2013 06:41 AM

I think you need to set up *mod_proxy* with the following config:

ProxyPass / http://localhost:8080/AppName/
ProxyPassReverse / http://localhost:8080/AppName/

It can be done through reverse proxy, may be I am not showing you the exact way, google it, you will get solution for this.

mlnm 04-03-2013 07:49 AM

As i mentioned in my last post ,actually i was using
ProxyPass / http://localhost:8080/AppName/
ProxyPassReverse / http://localhost:8080/AppName/

but as you know the image links were not working while i was using above code.

I think i have to go back to mod_proxy and try find the solution to image link errors.


All times are GMT -5. The time now is 10:51 AM.