I'd like to point all *.test domains to my Laravel Homestead machine on 192.168.10.10. I used to have it working with *.dev domains, but after new *.dev policy implemented by Chrome 63, I prefer to change it to *.test.
I fail to understand how local DNS works, as it seems to use trillion different configs and caches. What I did is:
Making sure 192.168.10.10 with HTTP Host set to me.test works. It works.
In /usr/local/etc/dnsmasq.conf, I do have an entry address=/.test/192.168.10.10 (I also tried with 127.0.0.1)
In /etc/resolver/test file, I put nameserver 127.0.0.1 - it used to work this way with /etc/resolver/dev. I still don't understand why it's 127.0.0.1 and not 192.168.10.10. I tried both anyway.
Clearing DNS cache with sudo killall -HUP mDNSResponder; sudo killall mDNSResponderHelper; sudo dscacheutil -flushcache
Restarting dnsmasq with sudo launchctl stop homebrew.mxcl.dnsmasq; sudo launchctl start homebrew.mxcl.dnsmasq.
Trying to visit http://me.test/.
It doesn't work. The domain will take forever to be loaded and nothing happens.
What am I doing wrong?
My OS is High Sierra, dnsmasq installed via homebrew.
I don't use dnsmasq, but I believe you want to edit /usr/local/etc/dnsmasq.conf and have listen-address=127.0.0.1 set so dnsmasq is listening on that IP, but have address=/.test/192.168.10.10 so that .test is routed to 192.168.10.10.
Then make sure System Preferences -> Advanced you have 127.0.0.1 as the first DNS server entry for your connection.
Make sure you're restarting dnsmasq every time you edit the configuration file.
Related
I'm trying to set up my local web development environment to map all .test domains to 192.168.10.10 IP. The problem is that I find all the tutorials extremely confusing.
Here's what I did already:
I installed dnsmasq using Homebrew with brew install dnsmasq command.
I put address=/.test/192.168.10.10 to /usr/local/etc/dnsmasq.conf.
I'm not sure what to do with the resolver. I have an /etc/resolv.conf file containing nameserver 172.20.10.1 (I don't know where it comes from) and then some tutorials say to create /etc/resolver/test file and putting nameserver 127.0.0.1 there.
Here's where I'm lost. First of all, which resolver should I use? The resolv.conf file or /etc/resolver/test? If that's the latter one, should I edit out the resolv.conf? And also, should I put nameserver 127.0.0.1 or nameserver 192.168.10.10? I don't understand if that's supposed to be the IP of my local machine (127.0.0.1) or my web dev machine (192.168.10.10).
Please help me to understand it better.
Until chrome just blocked me from using my http://development.app domain, everything was working. My laptop suddenly restarted and then development domain (http://development.app) started asking for SSL.
So I tried to move to http://development.local (and also tried .test but couldn't make it work also - but everything was working on .app)
In my osx:
nano /usr/local/etc/dnsmasq.conf
address=/.local/192.168.10.10 // also tried: address=/local/192.168.10.10
Then I restarted with:
sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq
Then in vagrant ssh:
sudo nano /etc/dnsmasq.conf
local=/development.local/
domain=development.local
address=/development.local/127.0.0.1
In my hosts, I have:
192.168.10.10 development.local
192.168.10.10 *.development.local
Now, http://development.local works however http://test.development.local doesn't however, before this change it was working with http://test.development.app . Going the url now returns me:
This site can’t be reached
test.development.local’s server IP address could not be found
I am not sure what it means at all but
dig test.development.local #127.0.0.1
> test.development.local. 0 IN A 192.168.10.10
I forgot about this step that I did earlier:
nano /etc/resolver/local
nameserver 127.0.0.1
I'm trying out Valet, it looks really nice from what I've heard.
I've been trough the "whole" installation process, Valet is succesfully installed.
But when I cd into my projects file and enter valet park and browse to http://blog.dev, I get "The DNS server address of blog.dev can not be found."
I have no idea what I'm doing wrong. :)
When you run valet install it attempts to install dnsmasq. It requires sudo privileges.
You can check that it's installed and running using
brew services list
You should see something like
dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
You may however need to tap brew/services first
brew tap homebrew/services
If it's not there, run
brew install dnsmasq
brew services start dnsmasq
Run valet install again to set up dnsmasq and keep an eye out for any errors. What this should do is append a line to the bottom of /usr/local/etc/dnsmasq.conf similar to
conf-file=/Users/{YOURUSER}/.valet/dnsmasq.conf
/Users/{YOURUSER}/.valet/dnsmasq.conf then should contain
address=/.dev/127.0.0.1
Check that your dns server is responding to requests
dig testing.dev #127.0.0.1
You should see a response like
;; ANSWER SECTION:
testing.dev. 0 IN A 127.0.0.1
To actually ensure that your Mac knows that it should resolve *.dev using your local DNS server, it need to be told to do so. Valet also handles this for you but you can check if it's done it's job by doing the following.
Inside the directory /etc/resolver, there should be a file entitled dev with the following contents
nameserver 127.0.0.1
This creates a custom DNS resolver for *.dev and points all requests at your local DNS server.
Restart dnsmasq with either of the following commands and then give it a try again.
// this
brew services restart dnsmasq
// or this
sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq
If this is all working, you should be able to ping anything.dev
ping anything.dev
PING anything.dev (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.039 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.081 ms
That ensures the DNS related bits are working.
Ultimately the question is about DNS related problems but as this started off as a here's everything you need to have tried, I'll leave this below. That said, if you're unable to ping something.dev or get an error like "The DNS server address of blog.dev can not be found." as per the OP, it's something above to do with DNS which needs resolving.
Since Caddy serves websites on port 80, you need to ensure that nothing else is running on port 80.
sudo lsof -n -i:80 | grep LISTEN
Ideally this should return caddy if valet is running as expected. You want to see the example below or nothing ideally; nothing because it means we can just start Valet.
caddy 76234 root 3u IPv6 0x4f871f962e84fa95 0t0 TCP *:http (LISTEN)
You may see other webservers, such as Apache or Nginx (and their child processes, _www and nobody) in the example below.
httpd 79 root 4u IPv6 0xf4641199930063c5 0t0 TCP *:http (LISTEN)
httpd 239 _www 4u IPv6 0xf4641199930063c5 0t0 TCP *:http (LISTEN)
nginx 4837 root 6u IPv4 0xf4641199a4e8e915 0t0 TCP 127.0.0.1:http (LISTEN)
nginx 4838 nobody 6u IPv4 0xf4641199a4e8e915 0t0 TCP 127.0.0.1:http (LISTEN)
Assuming you've installed Nginx with homebrew you can run the following to stop it.
brew services stop nginx
OSX ships with Apache installed so you can stop with with the following if it's running.
sudo apachectl stop
At this point you can likely start Valet with valet start and it'll work.
You may get a further error which is caused by PHP being installed without FPM. You can check this using
brew info php70 | grep php70-fpm
Which should yield something along the lines of
The control script is located at /usr/local/opt/php70/sbin/php70-fpm
If it doesn't appear to be installed, use the following.
brew uninstall homebrew/php/php70
brew install homebrew/php/php70 --with-fpm
valet restart
I had the same problem - getting stuck at ping foobar.dev - and fixed it by restarting my Macbook (after valet install). I am sure this is not an exact solution and I reckon there is a way to do this without restarting. Yet, it worked for me. I did not have to do any other steps.
[Edit - Additionally, before restarting I made sure to try the installing with fpm tip, and to follow all brew's suggestions upon installing php70 (tweaking the path, making sure php70 starts on system start. I cannot say whether these things helped, so probably want to try just restarting, first. If it's really just a restart that's required, or some other additional step to properly start services, I think the laravel documentation probably needs some clarification.]
I had the same problem, post installation I got stuck at pinging foo.dev.
I checked for running services.
> brew services list
Name Status User Plist
dnsmasq stopped
nginx stopped
php71 stopped
Started all the three services manually with
> brew services start dnsmasq
> brew services start nginx
> brew services start php71
Ran valet install.
Ping successfully to foo.dev
If you are a Windows user,
Perform the Acrylic Configuration then restart your adapter(Disable and Enable)
http://mayakron.altervista.org/wikibase/show.php?id=AcrylicWindows10Configuration
Worked For Me
Is it possible to route all subdomain requests regardless of top level domain to a given ip with dnsmasq?
I would like to get something like this to work.
address=/dev.*/127.0.0.1
So any production url if prefixed with dev will route to my dev server.
So any tld such as mysite.mobi or mysite.com if prefixed with dev. will still route to 127.0.0.1
So far I have tried the following with no luck
address=/dev./127.0.0.1
address=/dev*/127.0.0.1
address=/dev.#/127.0.0.1
address=/dev#/127.0.0.1
address=/#dev#/127.0.0.1
Any help would be great
Not prefixed but postfixed, I've done the following on Xubuntu (on 14.04):
# install "dnsmasq"
sudo apt-get install dnsmasq
# create a configuration file for using .dev as tld
sudo nano /etc/dnsmasq.d/devtld.conf
# add "address=/dev/127.0.0.1" and save the changes
# restart the service after configuring
sudo /etc/init.d/dnsmasq restart
Ensuring that any URL ending in ".dev" is routed to 127.0.0.1 aka localhost.
For example, after above configuration the following are equivalent:
http://localhost:8080
http://127.0.0.1:8080
http://www.example.com.dev:8080
http://subdomain.example.com.dev:8080
I'm using dnsmasq on the Mac (OS X 10.7) to facilitate local development (along with MAMP), with just this pretty simple config:
[dnsmasq.conf]
address=/dev/127.0.0.1
.. pretty darn simple. All my *.dev domains resolve to 127.0.0.1 (localhost). Together with:
[DNS Servers]
127.0.0.1
8.8.8.8
8.8.8.4
..as my Mac's DNS settings, this works a treat.
But then I also have a pretty stock Windows 7 SP 1 VM running in VirtualBox (latest). It uses 10.0.2.* as its IP subnet within Windows. At the moment I have to use a service like http://xip.io + another hostname alias to use my *.dev sites in Windows, e.g:
[ if Mac's local IP is 192.168.1.50 ]
something.dev.192.168.1.50.xip.io
..and I need to have this extra ServerAlias manually set up in my Apache config, and keep it updated each time my local IP address changes.
Is there any way I can set up either dnsmasq, VirtualBox, or my Windows IP settings (or a combination of these) so that I can use my .dev hostnames (e.g. http://something.dev/) directly from Windows?
Try this:
https://github.com/stackia/DNSAgent
It has functions similar to Dnsmasq server= and address=
and a rule converter: https://stackia.github.io/masq2agent/
If you mean that you want to run something like dnsmasq on your windows vm then I share your pain. I have been trying to get something setup on a windows host to do wildcard localhost sites without doing something like xip.io but I am having problems getting it to work. Dnsmasq on the osx machine I have was a breeze, but trying to get Acrylic DNS to work on windows the same way hasn't worked. I do have it running as a local caching DNS, and it should be doing the wildcard part, but having problems getting over the final steps.
Check it out. Looks neat, free, and a dnsmasq alternative on windows. And if you get it working post your results! I'll do the same if I can get it going.