1

I have apache web server :

<VirtualHost *:443>
  ServerName www.foo.com
  DocumentRoot /var/www/testApplication

  CustomLog /var/log/apache/testApplication-access.log combined
  ErrorLog /var/log/apache/testApplication-error.log

  # Example SSL configuration
  SSLEngine on
  SSLProtocol all -SSLv2
  SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
  SSLCertificateFile "/var/www/testApplication/ssl/server.crt"
  SSLCertificateKeyFile "/var/www/testApplication/ssl/server.key"
</VirtualHost> 

I would like to redirect request which came to:

localhost:443/WebService1.php to localhost:9003/ws
localhost:443/WebService2.php to localhost:9004/ws
  • 9004 and 9003 are ports on which java application is listening

I was trying to achieve it by modifying VirtualHost into:

ServerName www.foo.com DocumentRoot /var/www/testApplication

  CustomLog /var/log/apache/testApplication-access.log combined
  ErrorLog /var/log/apache/testApplication-error.log

  # Example SSL configuration
  SSLEngine on
  SSLProtocol all -SSLv2
  SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
  SSLCertificateFile "/var/www/testApplication/ssl/server.crt"
  SSLCertificateKeyFile "/var/www/testApplication/ssl/server.key"

  ProxyPass / http://localhost:9003/ws
  ProxyPassReverse / http://localhost:9003/ws
</VirtualHost> 

however this way everything is being redirected into 9003. How can I modify this setting so that both 9003 and 9004 will be used?

Mithrand1r
  • 2,313
  • 9
  • 37
  • 76
  • Since you wrote "WebService1.php" I suppose you have also php available on your server, maybe this could help you http://stackoverflow.com/questions/768431/how-to-make-a-redirect-in-php – Matteo Apr 07 '15 at 21:44
  • @Matteo to be honest I am little ashamed I didn't figured that this is possible to do it little bit easier. thx! – Mithrand1r Apr 07 '15 at 21:53
  • @Matteo I have validated it and it is not acceptable :( this way client is being redirected, and I want to handle connection localy – Mithrand1r Apr 08 '15 at 11:05
  • I suggest you to edit your question to add this information. Then you could try mod_proxy to forward the connection http://httpd.apache.org/docs/current/mod/mod_proxy.html – Matteo Apr 09 '15 at 13:25

0 Answers0