top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Apache Proxy redirect to an application?

+3 votes
358 views

I want to redirect a url to an application on same apache server. My development environment is Ubuntu. I enables the mod_proxy. But my url isnt redirecting to the desired application. Following is the code I put inside the /etc/apache2/sites-available/default file. I put this bottom of the file but before the "VirtualHost" tag.

ProxyRequests On 
ProxyVia On  
Order deny,allow 
Deny from all 
Allow from localhost  ProxyPass /application_directory/ http://localhost/application/directory ProxyPassReverse /application_directory/ http://localhost/application/directory 
posted May 11, 2014 by Kumar Mitrasen

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote

I am working on a Ubuntu 10.04 server, on which I installed PHP 5.3, Apache 2 2.2.9. I followed the below steps to do the installation :

  1. I installed apache2 using SUDO APT-GET INSTALL APACHE2

  2. I also installed libapache2 and php using the below commands
    sudo apt-get install php5 libapache2-mod-php5
    sudo apt-get install php5-core

  3. I did redirection to port by configuring the DEFAULT file in /ETC/APACHE2/SITES-AVAILABLE. Redirection happened successfully.

  4. PHP5-curl was installed using
    SUDO APT-GET INSTALL PHP5-CURL

  5. Rewrite mod was enabled in apache2 using
    SUDO A2ENMOD REWRITE and apache2 was restarted.

Now, after following this if I try to access the URL, I get the following message -

 THE REQUESTED URL /.../..../ WAS NOT FOUND ON THIS SERVER.  

But, the same URL is accessed from another system with the same configuration , it works fine.

+2 votes

I have a domain domain.com that points to a server. Now I have a subdomain sub.domain.com that points to another server that has Apache running and Tomcat. I want this subdomain to point to a application deployed on the Tomcat instance through ajp.

I have configured the following in httpd.conf:

   ServerName sub.domain.com 
   ProxyRequests Off
   ProxyPreserveHost On  
   Order deny,allow Allow from all  
   ProxyPass / ajp://localhost:8009/ 
   ProxyPassReverse / ajp://localhost:8009/   

and in Tomcats server.xml:

But when I go to sub.domain.com the url changes to otherdomain.com and shows me a php website running in Apache and declared as following in httpd.conf:

 DocumentRoot /var/www/html/otherdomain.com 
 ServerName otherdomain.com 
 ServerAlias www.otherdomain.com 

I only get it to work when I change the port in the sub.domain.com virtual host declaration to for example 8001. Then when I go to sub.domain.com:8001 it shows my tomcat application (ROOT.war) as expected.

So my question is: what could be going wrong that it doesn't work with the default port 80? I can't find any configuration that is causing this, but I'm probably missing something or is my virtual host configuration wrong?

+5 votes

WE are trying to setup HTTPS tunnelling to a backend server through Apache proxy but we are finding the client connect but Apache does not send through the traffic the backend server.

Config we have on our Apache proxy virtual host is

DocumentRoot "/usr/local/apache/htdocs/ibcm/" 
ServerName test.testdom.local 
ErrorLog logs/ibcm 
ServerAdmin webmaster@testdom.local 
ProxyRequests On 
AllowConnect 443 
SSLEngine on 
SSLHonorCipherOrder On 
SSLProtocol -ALL SSLv3 TLSv1 
SSLCipherSuite ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4RSA:HIGH:MEDIUM 
SSLCertificateFile "/etc/ssl/crt/ibcm.crt" 
SSLCertificateKeyFile "/etc/ssl/crt/testdom.key" 
SSLCertificateChainFile "/etc/ssl/crt/CA-DOM.crt" 
 Order deny,allow 
 Deny from all 
 Order deny,allow 
 Allow from all 

Anybody know what we are not doing correctly. Also we found Apache would not start without us putting in the root certificate. Thought it would not need any certificate for tunnelling so wonder if we have missed something.

+3 votes

How to do apache configuration to work as forward proxy.

...