Re: Apache Reverse Proxy for more than one website.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I changed my Virtual Host config as below:

<VirtualHost *:80>
    ServerName node3
    ErrorLog /var/log/httpd/node3_error_log
    TransferLog /var/log/httpd/node3_access_log
     <Location "/">
         ProxyPass  http://192.168.1.4/
         ProxyPassReverse   http://192.168.1.4/
     </Location>
   </VirtualHost>


    <VirtualHost *:80>
     ServerName node4
     ErrorLog /var/log/httpd/node4_error_log
     TransferLog /var/log/httpd/node4_access_log
     <Location "/">
         ProxyPass  http://192.168.1.20/
         ProxyPassReverse   http://192.168.1.20/
     </Location>
   </VirtualHost>


One of my Apache server (192.168.1.4) is turned off and I tried to see my server. Reverse Proxy must show other Apache server(192.168.1.20), but:

# cat /var/log/httpd/node4_access_log 
# cat /var/log/httpd/node4_error_log 

# cat /var/log/httpd/node3_access_log 
10.0.3.2 - - [17/Mar/2021:17:38:55 +0330] "GET / HTTP/1.1" 503 299
10.0.3.2 - - [17/Mar/2021:17:38:58 +0330] "GET /favicon.ico HTTP/1.1" 503 299
#
# cat /var/log/httpd/node3_error_log 
[Wed Mar 17 17:38:58.118507 2021] [proxy:error] [pid 14535:tid 14675] (113)No route to host: AH00957: HTTP: attempt to connect to 192.168.1.4:80 (192.168.1.4) failed
[Wed Mar 17 17:38:58.118635 2021] [proxy_http:error] [pid 14535:tid 14675] [client 10.0.3.2:43128] AH01114: HTTP: failed to make connection to backend: 192.168.1.4
[Wed Mar 17 17:39:01.190550 2021] [proxy:error] [pid 14536:tid 14737] (113)No route to host: AH00957: HTTP: attempt to connect to 192.168.1.4:80 (192.168.1.4) failed
[Wed Mar 17 17:39:01.190701 2021] [proxy_http:error] [pid 14536:tid 14737] [client 10.0.3.2:43130] AH01114: HTTP: failed to make connection to backend: 192.168.1.4, referer: http://127.0.0.1:2080/



It sounds like, Apache just read the first Virtual Host!!!







On Wednesday, March 17, 2021, 05:35:19 PM GMT+3:30, Antony Stone <antony.stone@xxxxxxxxxxxxxxxxxxxxx> wrote: 





On Wednesday 17 March 2021 at 14:57:06, Jason Long wrote:

> My current configuration is:
> 
> <VirtualHost *:80>
>      ServerName node3
>      ErrorLog /var/log/httpd/error_log
>      TransferLog /var/log/httpd/access_log
>      <Location />

I don't like the look of the / in that tag.  It's closing the <Location> tag 
before you've defined what it contains.  Try:

    <Location "/">

instead.

>          ProxyPass  http://192.168.1.4/ 
>          ProxyPassReverse  http://192.168.1.4/
>      </Location>
>    </VirtualHost>
> 
>    <VirtualHost *:80>
>      ServerName node4
>      ErrorLog /var/log/httpd/error_log
>      TransferLog /var/log/httpd/access_log

I also suggest using separate log files for separate servers, just to keep 
things clear.

> And my Reverse Proxy can see both of Apache web servers:

Good.

> On Wednesday, March 17, 2021, 05:15:35 PM GMT+3:30, Antony Stone wrote:
> 
> Show us what your configuration looks like now, and also tell us how you
> are testing it, what you expect the results to be, and what results you
> actually get.

You've done the first part, thank you.  How about the next parts?


Antony.

-- 
3 logicians walk into a bar. The bartender asks "Do you all want a drink?"
The first logician says "I don't know."
The second logician says "I don't know."
The third logician says "Yes!"


                                                  Please reply to the list;
                                                        please *don't* CC me.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux