I'm running local Apache on my mac for development, and also have node.js server running at http://127.0.0.1:8000/
.
I use .dev
domain for Apache projects and would like .node
domain to redirect to node.js server. I have virtual hosts set up as follows:
<VirtualHost *.dev:80>
VirtualDocumentRoot "/www/sites/%1/wwwroot"
ServerName sites.dev
ServerAlias *.dev
UseCanonicalName Off
</VirtualHost>
<VirtualHost *.node:80>
ServerName sites.node
ProxyPass "/" "http://localhost:8000"
ProxyPassReverse "/" "http://localhost:8000"
</VirtualHost>
However, when I try to apply these settings, I get the error:
[core:error] [pid 8594] (EAI 8)nodename nor servname provided, or not known:
AH00547: Could not resolve host name *.node -- ignoring!
I should note that .dev
domain works as expected, and node.js server is reachable at http://localhost:8000/
, just not at, say, http://test.node/
.
Am I missing something here?
Best Answer
Don’t you just hate when people make rookie mistakes and run to stackexchange for an answer?
Here’s what is being done wrong here:
localhost
is always a kosher thing to do.For homebrew dnsmasq on mac, this will do the trick:
And then OS X should be told to look up custom domain locally:
Custom domains 101 really.
localhost
without appending the custom port:8000
.Like this:
.node
is not currently a valid top-level domain, according to IANA. Changing it to something valid, like.no
, prevents that pesky Safari from initiating Google search on requests such astest.no
. (Say goodbye to the real.no
sites out there.)And Robert’s your father’s brother.