-1

I have a problem with my server, I know I can do Apache 80 to Tomcat 8080, but I need Tomcat 7 port 80 to Apache port 8080.

this is possible?

now: www.my-java-web.com and www.my-php-web.com:8080

final: www.my-java-web.com and www.my-php-web.com

Edit: opposite like this How do I redirect from Apache to Tomcat?

Community
  • 1
  • 1
Hardcarry
  • 11
  • 4
  • I flagged this question because it's unclear what you're asking. – Daan Apr 07 '15 at 14:29
  • i have one server with "tomcat 7 (java) port 80" and "apache (php) port 8080". I would like to redirect my website www.example.com (website on php) from my tomcat "port 80" (Java) to my Apache "port 8080". – Hardcarry Apr 07 '15 at 14:51
  • why don't you just change so that your tomcat is configured to be on 80 and apache on 8080? for what do you use redirection for? – eis Apr 07 '15 at 15:13
  • change apache port 80 and tomcat to 8080 ... It is my last option – Hardcarry Apr 07 '15 at 15:18
  • why? you need to explain your intentions clearly so we can answer this – eis Apr 07 '15 at 15:18
  • you could also just have a frontend apache, which could redirect to either tomcat or another apache instance – eis Apr 07 '15 at 15:18
  • beacuse tomcat application is on production and I can not stop long time – Hardcarry Apr 07 '15 at 15:26

1 Answers1

2

It's not 100% clear what you really want to do but I will try to achieve an answer for you which already works on my system:

now: www.my-java-web.com and www.my-php-web.com:8080

final: www.my-java-web.com and www.my-php-web.com

So you will have 2 different domain. Still apache needs to run on 80 simply change that in the apache2.conf or httpd.conf by adding LISTEN 80 because that will be the entry port.

You than can create a VirtualHost in the Apache which allows you to redirect the domain www.my-java-web.com directly to you java backend without and of course you then also need to change the tomcat port to another one than 80 because that's already in use by apache - no way to get rid of that task.

<VirtualHost *>
   ServerAdmin xx@example.com
   ServerName www.my-java-web.com
   ProxyPreserveHost On
   # setup the proxy
   <Proxy *>
      Order allow,deny
      Allow from all
   </Proxy>
   ProxyPass / http://localhost:{your new tomcat port}/
   ProxyPassReverse / http://localhost:{your new tomcat port}/
</VirtualHost>
DominikAngerer
  • 6,354
  • 5
  • 33
  • 60