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 have a website that runs on an IP, 23.222.22 for example

I have created my virtual host as /home/www/www.site.com in Apache as my web server.

However for development, before updating DNS, can I access the site like

http://23.222.22/~www.site.com/

Because

http://23.222.22/ just loads info from var/www

Thanks

share|improve this question
    
Yes, this seem fine right! What's your question!? –  F. Hauri Nov 1 '12 at 13:21

2 Answers 2

up vote 3 down vote accepted

Short answer: you can't directly

To get what you want:

  • Add that entry to your hosts* file, where your www.site.com will point to your ip
  • You can find a browser plugin, where you can add a Host header, to tell the webserver which vhost you wish to access

* c:\windows\system32\drivers\etc\hosts on Windows and /etc/hosts on *nix; just add 23.22.22.22 www.site.com at the end, and then open www.site.com in your browser

share|improve this answer
    
Works like a charm. Wanted to run this site in development without touching DNS and this works great! Thanks –  TheBlackBenzKid Oct 29 '12 at 11:37

If you setup your site as the default DocumentRoot for Apache then it should display that site when you access using an IP rather than the hostname.

Of course all your server variables for URL etc will be the IP rather than the hostname.

share|improve this answer

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.