Jump to content

Apache 2.2 sub domain help needed


Micah C

Recommended Posts

Hello Hak5 community! I finally setup Virtual hosts on Apache 2.2 on my computer. There is a problem tho. I cant access site1.domain.net or site2.domain.net unless i edit the "C:\WINDOWS\system32\drivers\etc\hosts.txt" and add my sub domains and my ip. It works fine on my computer but i would like to be able to have users access this without having to make this change on their system. I do not have trouble accessing http://domain.net on my machine or on a remote machine. Any help or ideas?

Link to comment
Share on other sites

Sounds like you haven't got DNS set up.

On the 'remote' hosts, for example. If you run NSLOOKUP on site1.domain.net or site2.domain.net. I assume it will come back with non existent domain right?

It works when you put it in the host files because you are resolving the sub domains to the IP address within that file, your computer does not need to look up the DNS to find it. You need DNS A records for each subdomain you create.

So if this is a local network of yours, what DNS server are you using? (You can find out my doing an ipconfig /all and looking for the DNS entry.) You will need the following on your networks DNS server.

site1.domain.net. IN A <IP ADDRESS>

site2.domain.net. IN A <IP ADDRESS>

If you are trying to get this to work EXTERNALLY out on the internet. You will need to add your subdomains to your current DNS settings with your DNS hosting provider.

Link to comment
Share on other sites

"On the 'remote' hosts, for example. If you run NSLOOKUP on site1.domain.net or site2.domain.net. I assume it will come back with non existent domain right?" yes this is correct. The odd thing is that I have DNS setup through Dynamic DNS. Do you need the IP of DNS or the ip of the sub domain? Both sub domains have the same IP: 192.168.7.150 ( same as the server IP ). Ultimately i would like to have it setup for external use although it is not setup at the moment.

Link to comment
Share on other sites

"On the 'remote' hosts, for example. If you run NSLOOKUP on site1.domain.net or site2.domain.net. I assume it will come back with non existent domain right?" yes this is correct. The odd thing is that I have DNS setup through Dynamic DNS. Do you need the IP of DNS or the ip of the sub domain? Both sub domains have the same IP: 192.168.7.150 ( same as the server IP ). Ultimately i would like to have it setup for external use although it is not setup at the moment.

You have it set up with DynamicDNS at the moment. What Dynamic DNS provider are you using? Log into your Dynamic DNS provider and go to the section where you can configure your domains or change your domain name etc. This is where you will have to add your subdomains.

SO at the moment, on whatever DynamicDNS you are using. You should have something similar to...

<your DynDNS external IP> IN A domain.net (or it might be simplified. And just show you your login against what your domain name is. It all depends on your provider)

Anyway, you need to add subdomains to that. So it would be like this...

<your DynDNS external IP> IN A subdomain1.domain.net.

<your DynDNS external IP> IN A subdomain2.domain.net.

Now this all depends on what Dynamic DNS provider you use. I can't recomend any as i don't use them. But log into their website and have a look at your settings and see if you can add any subdomains to your current domain.

Now that was for external. And it would also work for anyone internally trying to browse to it. Because i assume you aren't on a big LAN and you don't have an internal DNS server? If you don't have an Internal DNS server on your LAN, then the only way to get this to work is to

1) configure your dynamic DNS to also host your subdomains

or

2) Add an internal DNS server (you wouldn't bother if you were on a small network)

or

3) Just keep those entries in the host files for now.

But basically, you need external DNS set up correctly if you want other people to view these websites. So have a look around your DynamicDNS provider and see what you can find.

Good luck.

Link to comment
Share on other sites

Ahh what a waste of breath :P

I've never used OpenDNS. It should be pretty simple to add sub domains to it.

Surely there is a configuration page, find your domain name, and add 'A records' for your sub domains there.

Maybe google for 'Adding A records to OpenDNS' or something along those lines. SHould be pretty straightforward from there... now that you know what you are looking for :P

Link to comment
Share on other sites

Yeh i know. Sorry about making you go through that. Although you may be happy to find out that what you wrote wasn't at all a waste of time and effort. The problem wasn't my DNS it was actually how I configured DynDns settings. When i setup 192.168.7.150 to be hosted with micah.ath.cx I didn't check the box that says use wild cards. Once i checked it i was able to access site1.micah.ath.cx no problem on remote computer on my LAN. This wasn't an issue with A records. Thanks for all of your help,

Micah C

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...