I haven’t formally tested this, but if it’s true, it’s a nice bonus. Apparently, since BIND will be caching DNS info, it will make web browsing faster.So, v and anything.test will automatically stay local. You can set up TLDs to resolve to your local IP address.All I know is that it works and provides a few advantages over the hosts file: I’m not sure how it impacts the vulnerability of your Mac from a security standpoint. I just followed a few articles (on macosxhints and Ubuntu Forums) to get this working. I should mention here that DNS server stuff falls outside of my comfort zone. We just need to configure it and turn it on. Enter BIND - the built-in, but inactive DNS serverīIND (named) comes with Mac OS X. …and eventually, you end up with a hosts file a mile long. Instead, you have to have this: 127.0.0.1 v The only problem is the hosts file doesn’t support any wildcards. As can be seen in step 2, above, this is usually accomplished via the /etc/hosts file. The first thing you need for an Apache virtual host is a unique hostname. This allows me to separate sites like so: Sites Not only that, but I also decided to set up a few TLDs to separate my sites. Something like:Ĭreate a line in /etc/hosts for the domain:Īdd a few lines to my Apache conf file to configure the virtual host: ĭocumentRoot /Users/jason/Sites//public If you’re like me, you know this as a 4-step process:Ĭreate a directory for the site’s files. When starting a new site, the first thing I do is set up a virtual host for Apache. For years, I’ve developed websites on Mac OS X using the standard ‘MAMP’ setup: Mac/Apache/MySQL/PHP. To put this in context, let’s quickly review the old way. I can now create a whole new site on my MacBook just by creating a new folder! Much simpler than the old way. Combine that with a real DNS server (BIND), and you have a much smarter system. This is incredibly handy for development. That means you don’t have to create a virtual host in your conf files and restart Apache every time you want to create a new site. The first thing I didn’t realize is that Apache supports something called dynamic virtual hosts. It should only take about 10 minutes, at the most.) The whole process is really quite simple. (Editor’s Note: This article turned out to be a little longer than I expected. Well, a little research quickly brought me to the “how did I not know this before?!” point. I was talking about having to set up all those virtual hosts and whatnot. This past weekend, I was cleaning up my ~/Sites folder, and I started thinking, “There’s got to be a better way!” And I wasn’t referring to baby hammock.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |