45 Comments
- hyperfusion, on 10/12/2007, -2/+14Works on pretty much all *NIX, not just OSX.
- neoform, on 10/12/2007, -1/+13this isn't reddit, there is no minus digg.
- PathDaemon, on 10/12/2007, -1/+9Meh, kinda useful. I'll digg it, though it's not awesome-crazy like those centipedes.
To put it another way…
No idea if it blends. The insane blender man wouldn't bother trying. - psylence, on 10/12/2007, -3/+10If you need a video tutorial to set up a vhost, you __really__ shouldn't be a developer.
Even a web developer. - awhiteflame, on 10/12/2007, -1/+6The real amazing part is they're using nano when they have vi at their disposal!
- stukdog, on 10/12/2007, -1/+7A Video Tutorial for those who work better that way.
http://www.freemacblog.com/mac-server-series-hosting-multiple-web-sites-on-a-single-mac/ - awhiteflame, on 10/12/2007, -0/+4@neoform: You're right in the sense that you do the same thing on windows, you're wrong in the sense that this tutorial would help you at all if you didn't already know how to do it.
For reference, if you want to do this on windows, you have to use the file located at C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS. You may have to restart, too.. I don't remember for Windows. - xtr3m, on 10/12/2007, -0/+3And now the official way: http://docs.info.apple.com/article.html?artnum=88158
- pheen, on 10/12/2007, -1/+5See that link under the topics called "Add or Remove Topics"? Click that, uncheck Apple and then shut the ***** up.
- hlynch1, on 10/12/2007, -0/+4it is a lot easier to do a lot of things from command line, unless u are using windows. but u can open up the host file with whatever text editor u like
- 16x9, on 10/12/2007, -1/+4> allanak wrote: "This is lame. I thought most people who read digg knew how to edit /etc/hosts or even %windir%system32driversetchosts (digg removes my backslashes...)"
I suggest you post a modified version of this comment on EVERY story posted on DIGG. Feel free to copy this and use it at your leisure...
"This is lame. I thought most people who read digg knew how to [thingThatIFeelTheyShouldAlreadyKnowGoesHere]." - pukupi, on 10/12/2007, -0/+2Instead of attacking the hosts file, you could GUI your way through by duplicating the localhost machine with NetInfo Manager and changing the localhost name to whatever.dev.
If you want more than one development domain pointing to different directories, also make sure "NameVirtualHost *:80" is uncommented in your httpd.conf - josho, on 10/12/2007, -0/+2dev.yourdomain.com works great for sites where you're not implementing any sort of crazy catch-all DNS (say, username.yourdomain.com).
- psylence, on 10/12/2007, -1/+3Wow. Next week, how to tie your shoes and eat without hurting yourself.
- lolwtfhaha, on 10/12/2007, -0/+2I actually thought .dev was some kind of zeroconf mdns/bonjour thing like .local domains. ARG. Lame. You could just as well just edit your hosts file and use dev.yourdomain.com as your server. Ending your domain name with ".dev" just doesn't make any sense besides sounding cool.
Also, editing hosts files can be annoying; you can also use the modify headers firefox extention to change your host header on-the-fly which will let you type "localhost" but actually request whatever.com. edit-- depending on how well your applicaiton is written, /etc/hosts may be the only way to sufficiently trick your application. - r3zonance, on 10/12/2007, -1/+3"No restart needed"
Actually, if you want Apache to pick up the new virtual host that was added while it was already running, you MUST restart, otherwise it'll never pick it up. - dotdan, on 10/12/2007, -0/+2We do, just that I for one wouldn't have thought of doing this.
+digg - rasterbator, on 10/12/2007, -0/+1hell, since it is your own server and a fake domain, you could use .aspx
- r3zonance, on 10/12/2007, -0/+1Ending with a '.dev' TLD, makes it a lot more readily apparent that you aren't working on the live site. Besides a wildcard on the domainname.com would also "appear" to work on another machine if it was missing the hosts file entry.
- JonGretar, on 10/12/2007, -0/+1Exactly. In MacOs X the /etc/hosts, /etc/passwd, /etc/groups and more are basically there for backward compatability. Linux is also slowsly moving away from the old file structure for the directory method.
- lindmar, on 10/12/2007, -0/+1What does he mean when editing the httpd.conf
If NameVirtualHost is commented out, uncomment it? - pgib, on 10/12/2007, -1/+2Direct link to my script that does this process without having to do any actual work:
http://patrickgibson.com/news/andsuch/virtualhost.tgz - pgib, on 10/12/2007, -1/+2I wrote a script that we extensively use in the office to do just this. The script takes care of setting up Apache and Mac OS X to recognize the development host name.
To setup a host, you would just type:
sudo virtualhost.sh yourdomain.dev
Answer a couple prompts including what you want the virtual host's DocumentRoot to be, and away you go. To remove a virtual host you've created:
sudo virtualhost --delete yourname.dev
Note that this script is assuming the stock install of Apache that comes with Mac OS X, and that you haven't already messed around too much in httpd.conf.
http://patrickgibson.com/virtualhost - l0ne, on 10/12/2007, -0/+1Although I haven't seen Leopard, it was said on Apple mailing lists that NetInfo is going to be deprecated sooner rather than later in favor of pure OpenDirectory.
- Haplo, on 10/12/2007, -1/+1A tutorial for Windows, which has plenty of stuff for other OSes as well:
http://johnbokma.com/windows/apache-virtual-hosts-xp.html - pgib, on 10/12/2007, -1/+1See my post below -- I wrote a script that automates this whole process, and uses NetInfo Manger to handle the resolution. If you're working on a lot of sites, these tedious steps can get awfully tiring, which is why I wrote a script to take care it all for us.
- r3zonance, on 10/12/2007, -2/+2"This is lame. I thought most people who read digg knew how to edit /etc/hosts or even %windir%system32driversetchosts (digg removes my backslashes...)"
However, the Apache part is the bit where some people fall foul. - cviebrock, on 10/12/2007, -1/+1Stolen from me, from 2 years ago, although I do it the right way with Netinfo Manager.
http://viebrock.ca/code/32/virtual-hosts-on-os-x - benlong, on 10/12/2007, -3/+3Sweet. Thanks.
- Haplo, on 10/12/2007, -1/+1No restart needed, see: http://johnbokma.com/windows/apache-virtual-hosts-xp.html
Article has a lot of other useful tips. - TinyClanger, on 10/12/2007, -2/+2You need to restart Apache. You shouldn't need to restart Windows to get it to pick up a new hostname, though.
- chrisxkelley, on 10/12/2007, -1/+1It's a lot easier if you just use the netinfo manager(/Applications/Utilities/NetInfoManager) to add your ip/hostname, under machines->(hostname)
- pukupi, on 10/12/2007, -0/+0You should find NameVirtualHost *:80 around line 1065 in your httpd.conf. Uncomment this if you want to have more than one virtual host.
- champs, on 10/12/2007, -1/+0I want Apple articles, just not anything with "OS X", "iPod", or "Mac" in the title. Unfortunately, digg doesn't have a filter for "crap".
- oookye, on 10/12/2007, -9/+7Can't believe this made it to the front page
- xtr3m, on 10/12/2007, -5/+1I know. Please reread my post and notice the sarcasm. I wasn't complaining about having to use text editors to do the job. I was complaining about Mac's trend toward everything cute and disguising it as usability features.
- neoform, on 10/12/2007, -9/+4and windows...
- joaob, on 10/12/2007, -8/+3not everyone on digg is a raging dork
gets my digg - RyeBrye, on 10/12/2007, -9/+1Digging articles like this perpetuates the stereotype that Mac OS X users are dumb.
++digg!
(j/k..) - burke, on 10/12/2007, -10/+3Way to use the royal we there, jackass. Speak for yourself. I'm sure there are plenty of Mac fanboys that are plenty impressed with this. /dodges/
- allanak, on 10/12/2007, -13/+4This is lame. I thought most people who read digg knew how to edit /etc/hosts or even %windir%system32driversetchosts (digg removes my backslashes...)
- xtr3m, on 10/12/2007, -12/+2It's 2006 and Mac users still have to use terminal to edit the hosts file? That's amazing... Certainly there should be a $29.99 app with smoke effects for this!
- monergism, on 10/12/2007, -25/+2Must Digg Mac articles.
Must Digg Mac articles.
Must Digg Mac articles. - inactive, on 10/12/2007, -51/+2We're not impressed with some little mac trick you learned at DeVry.
minus digg


What is Digg?
Browsing Digg on your phone just got easier with our enhancements to the