Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

apache and router

Status
Not open for further replies.

binojohn

Technical User
Jul 22, 2005
2
US
Hi Experts,
I am a beginner in setting up apache webserver and subdomains. Though, I went through several posts on this forum I think my problem is kind of unique and am hoping some expert can poin beme to the right direction.

I have a domain (say dummy.org) registered with go daddy. Using the "DNS manager" on godaddy I have set up the domain to point to a linksys router which has a static IP address, 129.85.18.32. On the router set up , I have arranged for port forwarding on port 80 to port 80 of a computer that runs apache 2.0 webserver (mandrake) with TCP enabled (UDP disabled). I have setup the virual hosts file as shown below. I have also created a CNAME enty for a subdomain called edison that points to 129.85.18.32
NameVirtualHost 129.85.18.32
<VirtualHost 129.85.18.32>
ServerName edison.dummy.org
DocumentRoot /home/john/public_html
</VirtualHost>
<VirtualHost 129.85.18.32>
ServerName ServerAlias dummy.org*.dummy.org
DocumentRoot /var/</VirtualHost>

however when I request it retrieves ie to say, it looks up index.html in /var/ but NOT in /home/john/public_html as set up in the virtual hosts file. I dont know what I am doing wrong, please help

thanks to all of you who constantly make this world a better place.
john
 
By default, apache listens for all addresses on port 80 unless you bind it to an address or other port. In this case, you seem to be binding it to the same ip as your router. Your router should have two addresses. We'll call one the wan ip which is the public ip your isp provided you. The lan ip is the private ip address. Usually this is something like 192.168.1.1. Your server should have an ip in the same subnet as the router which basically means the first 3 octets need to be the same. You should give it a static ip from the router and not from the dhcp pool. For example, you could give it 192.168.1.10 assuming the is outside the range of available dhcp addresses. Now if you want to bind to an address it would be 192.168.1.10 but with name based addressing you can use the wildcard "*" because it looks for "ServerName" to resolve the request rather than the ip address. Another thing that I see wrong in that you have *.dummy.org as a ServerAlias. Apache sees *.dummy.org and edison.dummy.org as a match.
 
thank you very much, you raised a very good point about IP. the following worked.
NameVirtualHost 192.168.1.99

<VirtualHost 192.168.1.99>
ServerName edison.dummy.org
ServerAlias *.edison.dummy.org
DocumentRoot /home/bino/public_html
</VirtualHost>

<VirtualHost 192.168.1.99>
ServerName ServerAlias *.DocumentRoot /var/</VirtualHost>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top