This question has already been posted by another user but a detailed answer was not given..
Here is the link to the original question - One IP address, Two Websites, on Two Machines
I have two machines each with apache2 installed and static ip addresses.
Server 1
example.com
static ip = 192.168.0.6
apache2 running on ports 80 and 443 fine
ufw and router firewall are open on ports 80 and 443 as well
Server 2
domain name = myhost01.example.com
static ip = 192.168.0.7
apache2 running on 8080(HTTP) and 8443(HTTPS)
ufw and router firewall are open on ports 8080 and 8443
When I go to {http)www.example.com or (https)www.example.com - I correctly receive the web content for server 1
When I go to myhost01.example.com:8080 or myhost01.example.com:8443 - I correctly receive the web content for server 2
I would like to reverse proxy server 2 so when a user goes to http:// myhost01 .example.com/ they receive the content for http:// myhost01. example.com:8080/, basically hiding the port number. Currently, I get an "unable to connect/webpage not found" error, when i try to access myhost01(dot)example(dot)com
In the Virtual Host file for example.com, I used the following:
ProxyRequests Off
ProxyPass / http://myhost01. example.com:8080/
ProxyPassReverse / http://myhost01 .example.com:8080/
Both proxy and proxy_http modules are enabled in apache2
Any ideas on how to get this to work?
P.S. - Spaces were added to the urls because I do not have enough reputation points to post more than two urls.
** UPDATE - See notes below
Server1 - example.com - VHOST FILE
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /myweb/cmweb/apache/http
#ProxyPreserveHost On
ProxyRequests Off
ProxyPass / http://myhost01.example.com:8080/
ProxyPassReverse / http://myhost01.example.com:8080/
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
<Directory /myweb/cmweb/apache/http/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel warn
</VirtualHost>
Tried Proxy with 192.168.0.7 replacing myhost01(dot)example(dot)com to no avail
Server2 - myhost01(dot)example(dot)com VHOST File
<VirtualHost *:8080>
ServerAdmin [email protected]
ServerName myhost01.example.com
ServerAlias myhost01 myhost01.example.com
DocumentRoot /mwdhost/cmweb/apache/http
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /mwdhost/cmweb/apache/http/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LogLevel warn
</VirtualHost>
myhost01 has been added to A Record of Domain Registrant
can do an NSLOOKUP and get correct external ip address for myhost01.example.com
Here below is the Apache Error.log for server1 - Might be a clue to my problems???
Sun Feb 02 18:24:52 2014] [error] (111)Connection refused: proxy: HTTP: attempt to connect to 54.43.138.12:8080 (myhost01.example.com) failed
[Sun Feb 02 18:24:52 2014] [error] ap_proxy_connect_backend disabling worker for (myhost01.example.com)
[Sun Feb 02 18:24:53 2014] [error] proxy: HTTP: disabled connection for (myhost01.example.com)
[Mon Feb 03 07:33:54 2014] [warn] Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)