javaphptomcatapache2vesta

How bind my subdomain to my tomcat project on ubuntu with Vesta CP


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?


Solution

  • 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]