2016-09-18 2 views
0

ich habe zwei app in tomcat, die auf einem anderen System http://192.168.0.100/Tomcat App Reverse Proxy mit Apache HTTP-Server

in

  1. http://192.168.0.101:8080/app1/
  2. http://192.168.0.102:8080/app2/

Ich habe Apache HTTP-Server ausgeführt wird, läuft

Lassen Sie, ich habe eine öffentliche IP-Adresse mit 192.168.0.100 Server verbunden. Ich möchte zwei meiner Domäne auf http-Server hingewiesen konfigurieren.

  • Domain 1: one.app.com
  • Domain 2: two.app.com

Wie i i Apache HTTP-Server als Proxy revrse von tomcat App verwenden kann?

<VirtualHost *:80> 
ServerName one.app.com 
<Location/> 
    ProxyPass http://192.168.0.101:8080/app1/ 
    SetEnv force-proxy-request-1.0 1 
    SetEnv proxy-nokeepalive 1 
</Location> 
</VirtualHost> 

Über Config umleiten mich nur zu http://192.168.0.101:8080/app1/ :(

Antwort

1

Versuchen Sie folgendes:

<VirtualHost *:80> 
    ServerName one.app.com 
    SetEnv force-proxy-request-1.0 1 
    SetEnv proxy-nokeepalive 1 

    ProxyPass /app1 http://192.168.0.101:8080/app1/ 
    ProxyPassReverse /app1 http://192.168.0.101:8080/app1/ 

    ProxyPass /app2 http://192.168.0.102:8080/app2/ 
    ProxyPassReverse /app2 http://192.168.0.102:8080/app2/ 
</VirtualHost> 
+0

Verstanden Aber meine app hat statische Inhalte wie /app1/css/style.css abgebildet, die ist. versuchen zu bekommen, als: http://one.app.com/app1/css/style.css und damit keine css. :( –

+0

verwenden Sie vollständige Pfadnamen in Ihrer html/javascript-Datei? Wenn ja - es ist eine gute Praxis Um zu relativen Pfaden zu wechseln – chenchuk

+0

Nein, ich verwende relativen Pfad wie "/ app1/*/*/*" –

Verwandte Themen