0

I have remote server with one IP adress, where i having java and php projects. PHP project working with Vesta CP and java projects work with Tomcat 9. I have several domains and subdomains for my java projects, but i do not know how bind my subdomains with my java projects.

For example, i want joining this subdomain diagram.mathzilla.org with my project, which is available by adress and port http://78.24.217.121:8085/MZDiagram/.

How can I do it?

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
David Amirkhanov
  • 43
  • 1
  • 1
  • 10

1 Answers1

0

You can't bind two different servers (Apache Tomcat and Apache httpd) to same IP & port. But you can use mod_rewrite for Apache httpd for redirect some queries to other port inside server.

For example:

Tomcat is running on port 8085 and httpd is on port 80. In httpd for virtual host diagram.mathzilla.org you can redirect all queries to port 8085 via .htaccess file:

RewriteEngine on
RewriteRule ^(.*)$ http://localhost:8085/$1 [P]
ili4
  • 316
  • 2
  • 5
  • Create htaccess with `RewriteEngine on RewriteRule ^(.*)$ http://78.24.217.121:8085/MZDiagram/ [P]` It is work, but i have error in js console and project is not load [http://diagram.mathzilla.org/](http://diagram.mathzilla.org/). Why? – David Amirkhanov Aug 30 '17 at 07:50
  • Add $1 to the end of rediredt URL: `RewriteRule ^(.*)$ http://78.24.217.121:8085/MZDiagram/$1 [P]` – ili4 Aug 30 '17 at 07:56
  • `$1`, not `1$` :) – ili4 Aug 30 '17 at 08:02