Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Apache Reverse Proxy Support - 2 Servers Config |
|
Author |
|
igrummett
Joined: 06 Jun 2020 Posts: 4 Location: Sydney
|
Posted: Mon 09 Aug '21 13:31 Post subject: Apache Reverse Proxy Support - 2 Servers Config |
|
|
I hope the following is enough information. I have posted previously but I still haven't managed to resolve the problem.
Problem
I have 2 servers running Win 10 Pro & WAMP
I want to use Server1 as a proxy server & serve a website from Server2 via port 80 on Server1.
In summary, I want the following:-
www.myexample.com from Server 1 (working)
Demo.myexample.com from Server 1 (working)
newapp.myexample.com (problem) via Server 2
www.anotherexample.com (next problem) via Server 2
Current Setup
Server1: Windows 10 Pro (internal IP 192.168.0.31)
WAMP Apache V2.4.46
Connected to internet via modem and listening on port 80 & 443
‘Hello world’ test page working correctly via www.myexample.com
‘Hello Demo’ test page working via demo.myexample.com
This is the httpd.vhosts.conf for these 2 working
__________________________________________________
#Virtual Hosts on HTTPD-vhosts.conf - working fine
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www/"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
#localhost for demo working fine
<VirtualHost *:80>
ServerName local.demo
DocumentRoot "c:/wamp64/www/demo"
<Directory "c:/wamp64/www/demo/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#demo.myexample.com working fine
<VirtualHost *:80>
ServerName demo.myexample.com
DocumentRoot "c:/wamp64/www/demo"
<Directory "c:/wamp64/www/demo/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
_______________________________
This all works correctly therefore DNS a records, external IP address, firewalls are correctly configured.
Server2: Windows 10 Pro (internal IP address 192.168.0.7)
WAMP Apache V2.4.46
Reverse Proxy installed correctly same as Server 1
Website is served correctly via 192.168.0.7/newapp from localhost and server can be pinged from Server 1
newapp site also successful via http://192.168.0.7/newapp from Server2 on the internal network
Document folder is C:\wamp64\www\newapp\
Help Required
I have tried many different entries in httpd.vhosts.conf on Server1 to direct newapp.myexample.com to Server 2 then return to publish the page via Server1. I understand it needs to be a named or IP based reverse proxy but no luck.
Any help much appreciated as I am new to this area
Below is one example I tried but with no luck.
#newapp.myexample.com - not working
<VirtualHost *:*>
ProxyPreserveHost On
#
# # Servers to proxy the connection, or;
# # List of application servers:
# # Usage:
# # ProxyPass / http://[IP Addr.]:[port]/
# # ProxyPassReverse / http://[IP Addr.]:[port]/
#
# # Example:
ProxyPass / http://192.168.0.7/
ProxyPassReverse / http://192.168.0.7/
# <Directory "c:/wamp64/www/newapp/">
# Options +Indexes +Includes +FollowSymLinks +MultiViews
# AllowOverride All
# Require all granted
# </Directory>
# ServerName newapp.myexample.com
#</VirtualHost>
Thanks |
|
Back to top |
|
tangent Moderator
Joined: 16 Aug 2020 Posts: 348 Location: UK
|
Posted: Mon 09 Aug '21 21:39 Post subject: |
|
|
You say your Server 2 content is from http://192.168.0.7/newapp so have you tried using a <Location> section to contain your proxy pass directives (including a /newapp suffix), e.g.
Code: | <Location /newapp>
ProxyPass http://192.168.0.7:80/newapp
ProxyPassReverse http://192.168.0.7:80/newapp
</Location> |
See https://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass for details, taking note of the comments over trailing slashes. |
|
Back to top |
|
igrummett
Joined: 06 Jun 2020 Posts: 4 Location: Sydney
|
Posted: Wed 11 Aug '21 2:50 Post subject: Issue Fixed |
|
|
Thanks a lot. I had not considdered the <Location option and after a couple of attempts I now have the reverse proxy working
Much appreciated...... |
|
Back to top |
|
|
|
|
|
|