Apache subdomain redirected to Tomcat

I am new to Apache HTTP and the sysadmin as a whole, so I have this question I have a domain (www.doamin.com) with Apache listening on port 80, also I have Apache Tomcat in the same domain configured on port 8080.

Is there any way to configure the subdomain (i.e. tomcat.domain.com) so it will be redirected to my specific tomcat application, so the user can access the applications through app1.domain.com and app2.domain.com (and it will be served by Tomcat )?

I often mentioned

mod_jk

and

mod_proxy

but all posts require prior knowledge with Apache. can anyone lift me up

Thanks a lot, -PK.

+3
source share
2 answers

mod_jk . mod_proxy (mod_proxy_http mod_proxy_ajp) apache tomcat.

  • apache
  • -, tomcat

, SO .

(app1.domain.tld app2.domain.tld), . app1:

<VirtualHost *:80>
    ServerName app1.domain.tld
    ProxyRequests Off
    ProxyPreserveHost On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://localhost:8080/app1
    ProxyPassReverse / http://localhost:8080/app1
</VirtualHost> 
+10

,

.

  • DNS-

  • * mod_proxy * httpf.conf:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
  • NameVirtualHost *: 80

    <VirtualHost *:80>
        ServerName application.domain.com
        ProxyRequests Off
        ProxyPreserveHost On
        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>
        ProxyPass / http://www.domain.com:8080/application/
        ProxyPassReverse / http://www.domain.com:8080/application/
    </VirtualHost>
    
    <VirtualHost *:80>
        DocumentRoot C:\<pathToApache>\www
        ServerName www.domain.com
    </VirtualHost>
    

(www.domain.com) HTTP- Apache Tomcat.

, ,

-PK

+5

All Articles