Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to use mod_proxy to test a website I am building on a local virtual machine from my phone. My network looks like this:

Host:
IP 1: 10.10.10.2
IP 2: 10.211.55.2
OSX 10.8.2 / Apache 2.2.22
Parallels 8.0

VM guest:
IP: 10.211.55.3
Win7 / IIS 7.5

Phone:
IP: 10.0.0.8
Configured to use 10.0.0.2:80 as a proxy
iPhone iOS 6.0.1

I've inserted the following into http.conf:

ProxyRequests On
ProxyVia On

<Proxy *>
    Order deny,allow
    Deny from all
    Allow from 10.0.0
</Proxy>

<VirtualHost *:80>
    ServerName example.local 
    ServerAlias *.example.local
    ProxyRemote http://example.local/* http://10.211.55.3:80
    ErrorLog "/private/var/log/apache2/example-error_log"
    CustomLog "/private/var/log/apache2/example-access_log" common
</VirtualHost>

My /etc/hosts (on host OSX machine) currently doesn't reference example.local. Previously I have had a reference in /etc/hosts (on host OSX machine) and was able to view the site on the IIS guest from the host without any issue. Hence I believe the IIS guest is correctly configured to accept HTTP requests.

I am able to view a site hosted on Apache from my phone and am able to visit the BBC's site. Without the proxy configured on my phone I am unable to view the website hosted on Apache, but am able to view the BBC's website. Hence, I believe the phone is correctly configured.

This leaves configuring Apache. I've tested the config with apachectl -t and no errors are reported. I am unable to see any errors reported in the log files /var/log/example-error_log, /var/log/example-access_log, /var/log/error_log and /var/log/access_log.

I would be very grateful if anyone could point me in the right direction.

Many thanks, Chris

share|improve this question

1 Answer 1

For reference, this is how I resolved this:

1) Set up a DNS server on the LAN which is an authoritative name server for example.local. Both host and phone are configured to use this as their DNS server.

2) Configure host running Apache which already had mod_proxy and mod_proxy* loaded by adding the following to the end of /etc/apache2/extra/httpd-vhosts.conf.

<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyPass / http://10.211.55.3/ retry=1 acquire=3000 timeout=600 Keepalive=On
  ProxyPassReverse / http://10.211.55.3/
  ServerName example.local
  ErrorLog "/private/var/log/apache2/example.local-error_log"
  CustomLog "/private/var/log/apache2/example.local-access_log" common
</VirtualHost>

The host now acts as a reverse proxy for any machine on the LAN that uses the specially configured DNS server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.