Need help setting up: Apache Reverse Proxy

I have some problems setting the virtualhosts file in the right way. I would like to send vistors to the correct server using a reverse proxy. My current setup gives me an internal error.

I have only 1 public IP address and you want to proxy a visitor provided that the server name is correct on one of the local virtual servers.

NameVirtualHost *:80 <VirtualHost *:80> ServerName sub.domain.com ServerAdmin me@domain.com ProxyPreserveHost On ProxyPass / http://192.168.1.11:80 ProxyPassReverse / http://192.168.1.11:80 </VirtualHost> <VirtualHost *:80> ServerName otherdomain.com ServerAdmin me@domain.com ProxyPreserveHost On ProxyPass / http://192.168.1.12:80 ProxyPassReverse / http://192.168.1.12:80 </VirtualHost> 

If someone can find something that I am doing wrong, or I have another way to achieve my goal, I would love to hear that.

+4
source share
1 answer

It worked! used the following setting:

 <VirtualHost *:80> ServerName sub.domain.com ServerAdmin me@domain.com ProxyRequests Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://192.168.1.11/websvn/ ProxyPassReverse / http://192.168.1.11/websvn/ </VirtualHost> 

the / websvn / part needed to include css and other files correctly

In another downloaded .conf file:

  LoadModule proxy_connect_module /usr/lib/apache2/modules/mod_proxy_connect.so LoadModule proxy_ftp_module /usr/lib/apache2/modules/mod_proxy_ftp.so LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so 

Used to enable the necessary modules.

+4
source

Source: https://habr.com/ru/post/1383251/


All Articles