Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Giving my local web server a name instead of IP?

Giving my local web server a name instead of IP?
Thread Tools
Junior Member
Join Date: May 2000
Status: Offline
Reply With Quote
Jun 15, 2001, 05:54 PM
 
I currently have an iMac running Apache/PHP/MySQL for in house testing and learning. The iMac only serves to our local network, not the outside world.

It would be nice if everytime I wanted to bring up a web page from the iMac server, I didn't have to type its local IP address (192.168.x.x.) Is there any file I can tweak to make a name refer to this instead? Such as localhost refers to "this machine"

Instead of typing http://192.168.xx.xxx/test.html
I want to type http://home/test.html

or something to that effect.
M. Robert Spryn
Grad Student
NYU Center for Advanced Digital Apps
sprynmr@mac.com
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Jun 15, 2001, 09:33 PM
 
The only real way to do this is to install a DNS server (like BIND). But, this is probably much more work than it's worth.

Also, Windows IE seems to allow you to use on-network computer names in place of IP addresses. But, this is useless if you are working solely on macs.

[ 06-15-2001: Message edited by: mr_sonicblue ]
     
Junior Member
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jun 16, 2001, 02:25 PM
 
You'll prabably have to do something with NetInfo, but it may also be possible to add/alter the hosts file to your machine which redirects "this_machine" to 192.168.#.#..

On OS X, the hosts file is located in /etc/hosts and I could try adding the line:
192.168.###.### <tab> this_machine

On OS 9, I you place the hosts file anywhere. You need to enter the TCP/IP control panel and select the hosts file to be used, and the syntax is a little different but the idea is the same.

Good luck.
     
Fresh-Faced Recruit
Join Date: Apr 2000
Status: Offline
Reply With Quote
Jun 16, 2001, 03:48 PM
 
Could you do something like registering a domain name somewhere cheap like GoDaddy, and then head over to ZoneEdit for free forwarding to your IP address? I've been doing this to forward my domain name to the url of my free web site (which is hosted on a university server). Would this work for forwarding to an IP address rather than to another url??? It's cheap, and may be worth a shot.
     
Professional Poster
Join Date: Dec 2000
Location: boulder, co
Status: Offline
Reply With Quote
Jun 17, 2001, 04:18 AM
 
go to dyndns.org or dhs.org and get an IP forwarder for a static dns. It won't work from outside your network, but it will from inside.

This probably belongs in the networking forum, btw.
Ad Astra Per Aspera - Semper Exploro
     
sprynmr  (op)
Junior Member
Join Date: May 2000
Status: Offline
Reply With Quote
Jun 17, 2001, 01:01 PM
 
I got my answer actually. Its not nearly as hard as the other options suggested. (In fact editing the hosts file does not work. It only references to that file in single user mode.) Here is the answer I got of the omnigroup OSX list
Use Netinfo.

Go into /machines, and duplicate the entry for
localhost. Double-click the copy, and you'll see
fields for name and address.

Modify those fields to indicate the iMac.

If you'd like I can send you a screen grab of
what my machines domain looks like. I've added
my Win2K PC and my NeXT Cube.

- Jon
I don't know how to do this from OS 9 still, but I'm not terribly concerned about that anyway.

I put this here because it is most likely to be something dealt with be web developers running their own OS X servers at home. Sorry if its a bit off topic.

[ 06-17-2001: Message edited by: sprynmr ]
M. Robert Spryn
Grad Student
NYU Center for Advanced Digital Apps
sprynmr@mac.com
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Jun 17, 2001, 05:40 PM
 
The netinfo method works beautifully. Great tip.

BTW, don't worry about being off topic. This is far more related to web design than AlbertWu seems to think.
     
Professional Poster
Join Date: Dec 2000
Location: Staffs, UK
Status: Offline
Reply With Quote
Jun 18, 2001, 03:27 AM
 
I assume that you can also add entries for other machines on your network. I know that DNS is here for that, but for instance, at home I have 1 iMac and 1 iBook, but neither are running a BIND and I don't have a permanent net connection.

I assume I can add iBook: 192.168.1.2 and iMac: 192.168.1.1 ??

This should also work for all other networking protocols: afp://imac, ftp://imac, ssh://imac etc...
     
Mac Enthusiast
Join Date: Jan 2001
Location: Most probably sitting down, London, European Union
Status: Offline
Reply With Quote
Jun 19, 2001, 10:44 AM
 
You don't need a DNS server to do this, you can just edit the hosts file which is in "system folder references" (for 9.x, don't know where with X).

Enter lines like:

www.intra.net<tab>A<tab&g t;192.168.1.1
mail.intra.net<tab>A<tab& gt;192.168.1.11

Don't do:

home<tab>A<tab>192.168 .1.1

But do this:

home<tab>C<tab>www.int ra.net

There's some stuff in a Apple tech note about not assigning host names as A records where they don't have a top level domain - but you can do this with C names.

This method only works for the local machine that the hosts file resides on, so you'll have to copy it to other machines if you want them to use it.

I don't know the method for doing this on Win.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:35 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2