问题原文
原帖链接 · ajnabi · CC BY-SA 3.0
I need a quick solution that allows me to host multiple web servers behind my firewall. They are on different computers, so I can't use apache virtual hosting. I also don't want to use different non-standard ports for each machine.
The problem is my router can only forward port 443 to one machine. I thought the best solution would be to use reverse proxy or proxy forwarding, but I have been having problems understanding how to set this up.
- I am assuming that I can port forward all 443 traffic to one of the servers and make that the proxy server.
- All servers accept htmls traffic only.
- I am using DDNS and all the servers resolve to the same WAN IP address.
Setup:
- server1.domain.com = proxy and wiki server
- server2.domain.com = documentation server
- server3.domain.com = owncloud server
I tried putting the following in /etc/apache2/conf-available/proxy-pass.conf on server1:
SSLProxyEngine on
ProxyPass "/directory" "https://server2.domain.com/directory"
ProxyPass "/owncloud" "https://server3.domain.com/owncloud"
This works but it's not what I am looking for.
I need to direct all traffic to the server designated by the incoming URL domain name regardless of the directory because I have a lot of subdirectories after the base URL.
Something like:
ProxyPass "https://server2.domain.com" "https://server2.domain.com"
ProxyPass "https://server3.domain.com" "https://server3.domain.com"
Should I be looking to another solution, such as pound, or is there a way of doing this with apache. I figured I have apache installed, so use it?
已采纳解答
原帖链接 · HBruijn · CC BY-SA 3.0
They are on different computers, so I can't use apache virtual hosting
Actually that's is exactly what you need to do ;)
The manual is not explicit about it, but you reverse proxy everything for a specific host by making / , the root URL, the target for the ProxyPass directive in a virtual host entry:
<VirtualHost *:80>
ServerName host.example.com
ProxyPass / http://internalserver.example.net/
ProxyPassReverse / http://internalserver.example.net/
</VirtualHost>
<VirtualHost *:80>
ServerName host2.example.com
ProxyPass / http://other-internalserver.example.net/
ProxyPassReverse / http://other-internalserver.example.net/
</VirtualHost>
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
