On 1/18/22 9:57 AM, Raphael Mejias Dias wrote:
Hello,
Hi,
I'm trying to setup a reverse proxy on my apache2 server to serve an
another apache2 server running on a vm, basically my root apache2
is at 192.168.0.15 and my second apache2 is at 192.168.0.15:8280.
My idea is to have 192.168.0.15/zm as 192.168.0.15:8280.
If I understand you correctly, you want to take a sub-directory / path
from a site on one port (80) and reverse proxy it to the root of another
site on a different port (8280) on the same host. Am I understanding
you correctly?
The question is, how to do it?
I need to finish my $CAFFEINE before I formulate a complete answer. But
I'm sharing an incomplete answer to hopefully get you down the road sooner.
I've looked up some guides, but it is difficult to setup.
Like most things Apache, it's mostly difficult the first (few) time(s)
you do it. Once you've done it, it's not as bad.
My config:
I'm redacting the things that I think aren't germane to the question at
hand.
<VirtualHost _default_:443>
ServerName 192.168.0.15
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:443>
ServerName 192.168.0.15/zm
ProxyPass /zm http://192.168.0.15:8280/zm
ProxyPassReverse /zm http://192.168.0.15:8280/zm
</VirtualHost>
Does it look any good?
I question the use of "_default_" and "*", both of which on port 443.
My fear is that there is a large potential for confusion ~> conflict
between these two named virtual hosts.
I'm also not seeing the config for the instance listening on port 8280.
If the second named virtual host was put in place specifically in
support of the reverse proxy, then I think you want to refactor it as a
<Directory>...</Directory> under the original named virtual host.
The other thing that I'm not seeing is the <Proxy>...</Proxy>
configuration that I would expect to see. E.g.
<Proxy>
Order deny,allow
Deny from all
Allow from 192.0.2.0/24
Allow from 198.51.100.0/24
Allow from 203.0.113.0/24
</Proxy>
Beyond that, I need to finish my $CAFFEINE, have some clarification from
you, and look at specific failures.
N.B.: The access and error log files are going to be your friend when
configuring this (or really anything Apache httpd related) as they will
let you know when your configuration is correct but things like
permission (Allow from) are the problem. Also apache(2)ctl configtest
is your friend.
Thanks.
You're welcome.
--
Grant. . . .
unix || die