0

We have a local development server we have setup on a comcast business class connection with a single static ip. This is all routed through a DIR 655 router. Our issue is as follows: We have our main documentroot setup as /var/www/html of course, but the problem comes in when we try to setup our virtualhosts. We have a domain that resolves to the single static ip, and we need several sub domains. Normally you would just use a namevirtualhost pointed to the ip that you want to share, then setup the virtualhosts to meet your needs, but I don't see how this is possible with a single ip o nthe server. The ip is already sending everything to the /var/www/html documentroot directory. We're at a loss at this point. We figured an easy fix would be a second ip address, but how does one map two ip's to a single device on a low end router like the dir 655? Anyone out there have some advice?

Thanks in advance.

2 Answers2

2

I'm not entirely sure that I understand your requirements… But, provided you don't need SSL, you can have as many virtual hosts on one IP as you'd like:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias foo.example.com foo
    DocumentRoot /var/www/example/
</VirtualHost>
<VirtualHost *:80>
    ServerName spam.com
    ServerAlias eggs.spam.com
    DocumentRoot /var/www/spam/
</VirtualHost>
David Wolever
  • 2,267
  • 3
  • 24
  • 27
1

This is strange... I have precisely the same setup as you do (Comcast business, DIR-655, etc...).

In your httpd.conf file, have you set the following?

NameVirtualHost YOUR_IP_ADDRESS_HERE:80

tambler
  • 131
  • 1
  • 5
  • 1
    I'm sorry if that seemed a little obvious, but your question is kind of vague. As long as you setup NameVirtualHost correctly and defined your VirtualHosts as David Wolever suggests, you should be set. The fact that you have only one IP address is not a problem. – tambler Feb 02 '10 at 23:32