DNSMasq Not Resolving Addresses on Mac Local Web Development Environment

I've setup my local web development environment according to -http://mallinson.ca/osx-web-development/. I have done this before, and I got on a new computer, and am trying to do it again. I'm running Apache 2.4.9 on Mac OS X Yosemite 10.10.2 and directing the DNS with dnsmasq. I believe this is a problem with my setup for Apache and such for this computer, not with DNSMasq, which is why it is on this forum. If you have any ideas on how I could 'reset' all the settings and web server applications for OSX that would be great.

When I try to go to home.dev, it received this error:

Error code: ERR_NAME_NOT_RESOLVED

When I run scutil --dns, it seems to resolve it correctly as:

resolver #3 domain : dev nameserver[0] : 127.0.0.1 flags : Request A records, Request AAAA records reach : Reachable,Local Address

However, when I:

ping -c 1 home.dev

I get

ping: cannot resolve home.dev: Unknown host

Here is my reference to it in vhosts:

<VirtualHost *:80> VirtualDocumentRoot "/Volumes/Work/Home/www" ServerName home.dev UseCanonicalName Off </Virtualhost>

MacBook Pro, Mac OS X (10.7.2)

Posted on May 29, 2015 2:47 PM

Reply
5 replies

Jun 2, 2015 2:03 PM in response to etresoft

Good point. Typically I develop in Wordpress, so that isn't a problem, but that is helpful to keep in mind for non-wordpress sites that may come my way.


I also found the fix though. I think it was a change from Maverick's to Yosemite. In Yosemite, I had to add "port 35353" to the /etc/resolver files as well as as the config file for DNSmasq. I know for a fact I didn't originally do that, and it originally worked, so there was a change somewhere in there that broke it. Possibly also from a newer version of DNSmasq.

May 29, 2015 8:34 PM in response to lawrenkw2014

Helloo again lawrenkw2014,

I'm sorry, but that's just crazy - for a number of reasons. You most certainly don't need any DNS hacks. Just edit /etc/hosts if you need something like that. That is what it is there for. Here is a better guide for setting up your Mac as a local web server: Setting up a local web server on a Mac


The most important thing to remember when doing web development is where you will be deploying. In most situations, that will be some shared Linux server. You don't want to get too fancy with your development environment because you will have relatively little control over your deployment environment.

May 30, 2015 8:29 AM in response to etresoft

Thanks, but I really like the ability to have the website automatically load up at "*.dev", without having to add each one to the /etc/hosts and in the vhosts. It is just that many less steps to deploying a local development environment, and therefore, that many less in getting the website in production. I know it may be more work than is worth it, but I'm foolish enough to like it I guess 😉.

May 30, 2015 11:09 AM in response to lawrenkw2014

Hello again lawrenkw2014,

I'm afraid the opposite is true. It is better to design your sites so that they are flexible enough to be run from a subdirectory. Having a dedicated root is easy. Designing a site, from the start, with a relative path in mind as a possibility is not so hard. Trying to port a completed site that requires a dedicated domain to one running from a subdirectory is a major effort.


I build all of my sites so they run from my home directory. Then, deploying to a dedicated server is easy. If I need to deploy some beta version alongside the main, in a subdirectory, I can do it with a config file change. Depending on who your client is, getting root of a public server can take months. This way, I can deploy new sites, anywhere I want, in minutes. It is a little more work at the beginning, but that kind of architectural work is far easier at the beginning than it is at the end, when the project is already late.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

DNSMasq Not Resolving Addresses on Mac Local Web Development Environment

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.