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.

I'm migrating from old server into new server. my current domain is pointing to Old server and want to test before go live. The problem is how to connect to New Server for internal test. I dont know how to connect into it directly via server ip.

Server: CentOS 6, and use Directadmin.

share|improve this question
    
What do you mean by "server"? Do you mean a physical machine or a piece of software? And what do you mean by "connect"? Do you mean with a browser? Or something else entirely? –  David Schwartz Nov 26 '12 at 3:22

2 Answers 2

up vote 2 down vote accepted

Connecting via an IP address may not work as you expect. The best thing to do here is to edit the hosts file on the system you are connecting from and add an entry that points to the new server for the new server. If your server is example.com and it's ip address is 192.168.1.1 then an entry like

192.68.1.12    example.com

It looks like the server you have is configured for [name based virtual hosting][1]. For this to work the client needs to provide a Host: header that the server can map to a suitable definiton e.g.

Host: example.com

When you connect to your server using just an IP address, no suitable Host: header is provided

Host: 192.168.1.12

so the server returns the content from the default vhost (usually the first one configured).

For the purpose of your testing you need to provide a Host: header for example.com. To do this you need to arrange for example.com to resolve to the IP address of your server. The easiest way to do this is to edit your hosts file asI said above.

share|improve this answer
    
my new server is running on virtual host if i point to IP directly it will not bring me to the example.com but it will bring to server ip instead. Then how can i connect into virtual host via ip (example 192.168.1.12/~mydomian) –  RAGOpoR Nov 25 '12 at 9:59
    
absolutly perfect ! –  RAGOpoR Nov 25 '12 at 12:16

What virtualisation are you using? You can usually bridge the adapter and give the virtual host an address on your local network, separate to your physical address. I do it all the time testing services on my workstation at w. Alternatively you can use NAT on the virtual machine and use the virtualisation software to forward the ports... Pretty sure virtual box and VMware allow this.

Or am I reading the question wrong?

share|improve this answer
1  
Probably, my guess is the OP is talking about Name Based Virtual Hosting. –  Iain Nov 25 '12 at 10:08

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.