Wie konfiguriere ich zwei Adressen für den Zugriff auf andere Frontends / verschiedene Ports, zum Beispiel:
Adresse | Zuordnung zu |
---|---|
www.mysite.com/config | (nodejs) localhost:3000 |
www.mysite.com/client | (Django) localhost:7000 |
Antwort1
Verwenden Sie die Suche
- Wenn Sie die Wörter "Apache-Proxy" verwendet hätten, würden Sie ähnliche Fragen finden wie
- Apache-Reverseproxy zum Docker-Container
- und viele weitere ähnliche Fragen
Lösung, um Ihr Gehirn in einem Beispiel nicht zu überfordern
Apache
<VirtualHost *>
ServerName www.example.com
ProxyPass /config http://localname:3000/
ProxyPassReverse /config http://localname:3000/
ProxyPass /client http://localname:7000/
ProxyPassReverse /client http://localname:7000/
</VirtualHost>
Nginx (nur für den Fall, dass Sie es brauchen)
location /config {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $http_host;
}
location /client {
proxy_pass http://127.0.0.1:7000;
proxy_set_header Host $http_host;
}