Search

Top Posts

Comments

  • Fred: Works fine with my Google Chrome.
  • Dave M.: I’m sorry, but you expected TurboTax to support a “BETA” browser and were surprised that...
  • David: thanks! And Hey I wasn’t calling you a liar just that the image may have been a fake and i said that i...
  • Dagaza: Thanks for the post, itunes also has an option to “Show Exact Duplicates” meaning you don’t...
  • maria Nicolaou: I have a Mac Os X version 10.5.8 and I was wondering if I can change my keyboard to a light one!

Categories

Recent Posts


Set a local domain to ease local development

If you’re a web developer you probably do a fair amount of development on your local machine using either the built-in Mac OS X Apache server or, in my case, something like MAMP. You can make your local development life a bit easier by setting a local domain, here’s how.

from the Mac Terminal type the following:
sudo nano /etc/hosts

this will bring up the /etc/hosts file in the nano editor, it will look something like this:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost

next, you’ll want to add the hostname (in this case, local.dev) you’d like to use locally to the end of that file on a new line, in the following format:
127.0.0.1 local.dev

Save the changes to /etc/hosts file by hitting Control-O and then Control-X to exit. Now you can access your local domain via the web browser, ftp, or whatever other means.

Posted by: Bill Ellis

Share

Save big on Mac Deals from Amazon.com

Comments:

Comments: 5

Comment from hypnopixel
Time: October 28, 2009, 2:58 pm

Hi Bill,

how is this different than using ‘localhost’ which is already aliased?

regards,

aitch

Comment from Woodgie
Time: October 29, 2009, 4:55 am

It’s prettier?

It also allows you to create more than one ’site’ in conjunction with a bit of apache config twiddling. Something along the lines of:
site1.domain.whatever
site2.domain.whatever

Don’t ask me how, this is a comment, not a hint!

:-)

Comment from hypnopixel
Time: October 30, 2009, 10:41 am

@Woodgie, ah, I see that. And for brevity, the alias could be shorthanded to, say, lh.d, lh.qa, and lh.p for dev, qa and production. Yeah, the apache config twiddling needs to be alluded to, at least ;-]

Comment from Frank Leigh
Time: November 5, 2009, 1:34 pm

There is more to it than that. The main benefit is your local websites will have private sessions from one another thus preventing session overwriting when you swicth between one site and another using the same browser instance.

Comment from Andy Jones
Time: November 23, 2009, 6:36 am

Does this mean I can do without MAMP?

Write a comment






October 28th, 2009