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.

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.

share|improve this question

migrated from stackoverflow.com Feb 3 '10 at 22:36

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers 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>
share|improve this answer
add comment

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

share|improve this answer
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 2 '10 at 23:32
add comment

Your Answer

 
discard

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