1 |
On 1/18/22 9:57 AM, Raphael Mejias Dias wrote: |
2 |
> Hello, |
3 |
|
4 |
Hi, |
5 |
|
6 |
> I'm trying to setup a reverse proxy on my apache2 server to serve an |
7 |
> another apache2 server running on a vm, basically my root apache2 |
8 |
> is at 192.168.0.15 and my second apache2 is at 192.168.0.15:8280. |
9 |
> My idea is to have 192.168.0.15/zm as 192.168.0.15:8280. |
10 |
|
11 |
If I understand you correctly, you want to take a sub-directory / path |
12 |
from a site on one port (80) and reverse proxy it to the root of another |
13 |
site on a different port (8280) on the same host. Am I understanding |
14 |
you correctly? |
15 |
|
16 |
> The question is, how to do it? |
17 |
|
18 |
I need to finish my $CAFFEINE before I formulate a complete answer. But |
19 |
I'm sharing an incomplete answer to hopefully get you down the road sooner. |
20 |
|
21 |
> I've looked up some guides, but it is difficult to setup. |
22 |
|
23 |
Like most things Apache, it's mostly difficult the first (few) time(s) |
24 |
you do it. Once you've done it, it's not as bad. |
25 |
|
26 |
> My config: |
27 |
|
28 |
I'm redacting the things that I think aren't germane to the question at |
29 |
hand. |
30 |
|
31 |
> <VirtualHost _default_:443> |
32 |
> ServerName 192.168.0.15 |
33 |
> DocumentRoot /var/www/html |
34 |
> </VirtualHost> |
35 |
> |
36 |
> <VirtualHost *:443> |
37 |
> ServerName 192.168.0.15/zm |
38 |
> ProxyPass /zm http://192.168.0.15:8280/zm |
39 |
> ProxyPassReverse /zm http://192.168.0.15:8280/zm |
40 |
> </VirtualHost> |
41 |
> |
42 |
> Does it look any good? |
43 |
|
44 |
I question the use of "_default_" and "*", both of which on port 443. |
45 |
My fear is that there is a large potential for confusion ~> conflict |
46 |
between these two named virtual hosts. |
47 |
|
48 |
I'm also not seeing the config for the instance listening on port 8280. |
49 |
|
50 |
If the second named virtual host was put in place specifically in |
51 |
support of the reverse proxy, then I think you want to refactor it as a |
52 |
<Directory>...</Directory> under the original named virtual host. |
53 |
|
54 |
The other thing that I'm not seeing is the <Proxy>...</Proxy> |
55 |
configuration that I would expect to see. E.g. |
56 |
|
57 |
<Proxy> |
58 |
Order deny,allow |
59 |
Deny from all |
60 |
Allow from 192.0.2.0/24 |
61 |
Allow from 198.51.100.0/24 |
62 |
Allow from 203.0.113.0/24 |
63 |
</Proxy> |
64 |
|
65 |
Beyond that, I need to finish my $CAFFEINE, have some clarification from |
66 |
you, and look at specific failures. |
67 |
|
68 |
N.B.: The access and error log files are going to be your friend when |
69 |
configuring this (or really anything Apache httpd related) as they will |
70 |
let you know when your configuration is correct but things like |
71 |
permission (Allow from) are the problem. Also apache(2)ctl configtest |
72 |
is your friend. |
73 |
|
74 |
> Thanks. |
75 |
|
76 |
You're welcome. |
77 |
|
78 |
|
79 |
|
80 |
-- |
81 |
Grant. . . . |
82 |
unix || die |