Question

Apache2 (CKAN) + TOMCAT6 + Mod Proxy Problems

Hello,

I have a server running CKAN over Apache2, this server also have a tomcat6 hosting some HTML pages. Apache is running in 8080 and Tomcat in 8081. Nginx is used to make Apache accessible through port 80.

I have a web in the tomcat served in

http://195.57.27.91:8081/arboles 

I would like to make this web accessible through the port 80 so I use Mod Proxy from Apache2 to make a internal proxy that redirects the incoming request asking for /arboles to port 8081. This has been done by using http.conf like this:

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so


ProxyRequests Off
ProxyPreserveHost On


<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass /arboles http://195.57.27.91:8081/arboles/
ProxyPassReverse /arboles http://195.57.27.91:8081/arboles/

In do know this Proxy is working because I have tried it in another server with another domain successfully.

PROBLEM: When I try to resolve the URI:

http://195.57.25.27/arboles

It doesn't load the page. All I get is 504 Gateway Error Time-out.

Error

I have checked the Apache2 logs and there is no track of error or misconfiguration, I don't know what else to try. Any ideas?

EDIT: I forgot to mention nginx log:

2014/01/31 10:39:28 [error] 13921#0: *321 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 158.49.219.193, server: , request: "GET /arboles/ HTTP/1.1", upstream: "http://127.0.0.1:8080/arboles/", host: "opendata.caceres.es"

Note: opendata.caceres.es is the domain name for the server.

Was it helpful?

Solution

Ok, finally I have solved the problem (props to Ross Jones for pointing out the idea).

Basically what I have done is redirect the URIS that have /arboles in their path to port 8081 by using nginx instead of Apache2. To do that I've modified my sites-enabled in /etc/nginx (I also could have add another site) to add the following redirection:

location /arboles {
                proxy_pass http://127.0.0.1:8081/arboles/; 
                proxy_set_header Host $host;
                proxy_cache_key $host$scheme$proxy_host$request_uri;
        }

Hope this can be interesting for somebody in the future.

NOTE: if you don't have conf files in sites-enabled & sites-available you can make this changes in the conf.nginx file. Jesús.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top