Reputation: 31
I have several of my development web sites on my Mac, each set up as virtual hosts in Apache. For example: example.dev, example2.dev, example3.dev. (I know we're not supposed to use .dev anymore, but I'll do that for my next project.)
I have an iPhone tethered via USB and would like to access the *.dev sites via Safari for testing.
I can access Apache's main directory via the Mac's IP address or .local, but I can't figure out hot to get to the virtual hosts; it throws a 404. Is there a way to get the iPhone to use the same DNS settings as the Mac?
Upvotes: 3
Views: 645
Reputation: 2460
One thing you can do is to install dnsmasq
on your mac.
First install dnsmasq:
brew install dnsmasq
Run the configuration command it asks you to, which may look similar to this:
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
Now you can edit the configuration at /usr/local/etc/dnsmasq.conf. Add the following line: (I put mine right below the line that says "#address=/double-click.net/127.0.0.1")
address=/*.dev/192.168.1.10
192.168.1.10 is your private ip address
Now restart the dnsmasq service
sudo brew services restart dnsmasq
Hope this works for you.
Upvotes: 0