views:

50

answers:

3

I have this webserver that have an IP address xxx.xxx.xx.x, I also have a website I want to publish, but I do not have any domain for my website yet.

So in my httpd-vhosts.conf file I have this setting:

<VirtualHost xxx.xxx.xx.x>
  ServerName xxx.xxx.xx.x
  DocumentRoot "C:\Sites\mysite"
</VirtualHost>

And since I dont have a domain I really want to use the IP address to reach my site, but I have tried this and it does not work. I guess you HAVE to set a server name in ServerName as the title says.

Are there any ways for me to make my website public through my IP address, if yes how can I do this?

A: 

This is not a programming question.

But anyway,

Set the VirtualHost to * rather than a specific IP address. I don't think you need the servername either then.

Laykes
Thx for your reply, I know it is not a programming question but sill I think this is the correct forum to ask questions of this kind. I tried your solution:<VirtualHost *> DocumentRoot "C:\Sites\mysite"</VirtualHost>But still I dont get my site if I enter the IP of my server, and I have restarted Apache and checked that my server responds to ping.
Martin
@Martin - serverfault.com is the correct forum for these kinds of questions.
Andy Shellam
Thx Andy, now I know that for later :D
Martin
+1  A: 

Try

NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot C:\Sites\mysite
  ServerName xx.xx.xx.xx
</VirtualHost>

Remember to restart apache,

You may also need to add,

Listen xx.xx.xx.xx:80
John
Thank you, it works.
Martin
A: 

If you only have the one website on this server, you don't need a virtual host. Just set the DocumentRoot correctly and away you go. Also make sure Apache is listening on all IP addresses (Listen 0.0.0.0:80.)

If that doesn't work for you, from your command prompt do:

telnet xx.xx.xx.xx 80
GET /

and see what you get back - you should get your website's default page.

Andy Shellam
Thank you for your suggestion, but I do run multiple sites and they work perfect since they have domains that are reffered to in the `httpd-vhosts.conf` file. But this one does not work since I dont have a domain, only a IP address.
Martin
It may be that you can't mix name-based virtual hosts and IP virtual-hosts unless you have an IP that the name-based hosts share, and another separate IP for your IP-based host. Can you not just knock up a temporary DNS name on an existing domain - e.g. test.yoursite.com?
Andy Shellam