Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Right now I access my dev. server as localhost.

How do I change it so that I can type "myservername" and it will work as an "alias" for localhost?

Thanks

share|improve this question

2 Answers 2

Add an entry to your hosts file such as:

127.0.0.1     myservername.mydomain.local myservername

Where the file is located depends on your OS but all files are the same.

share|improve this answer
    
This is definitely the answer to the question, but I don't generally like aliasing things to "localhost" so much as I do the external IP of the machine, unless there's a security issue with it running on the external interface. Just personal habit, I suppose. –  Matt Simmons Jun 25 '09 at 2:39
    
this sort-of works. the pages load, but they load slowly. plus, not all the images/css files load. It seems random which ones do load. But, if I navigate to the files directly like myservername/images/anything.png they all load instantly...wierd... –  Chris Krinler Jun 25 '09 at 2:40
    
I'm trying to get it so that my host machine and virtual pc can load all the images and css files using the same urls. I've been playing around with the host files on both. It seems I can't change the virtual pc's host file to set the host's ip as localhost. That would be the easiest. –  Chris Krinler Jun 25 '09 at 2:42
    
Using the Public, Private IP is acceptable also. If I was locking things down, I would certify that only the actual IP was being used instead of the loopback and certify that the loopback was also not answering requests for services. Having multiple entries in a host file is acceptable. This file is checked before any network name resolution is performed such as WINS, DNS, NetBios or your preferred protocol. –  Jason B Shrout Jun 25 '09 at 20:16

Add an entry for "myservername" in your hosts file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.