Apache Virtual Hosts

Hardware, Software, Internet, etc.

Moderators: Big-O Ryan, Big-O Mark, Matt, jester22c

Post Reply
fuuucckkers
Moderator
Moderator
Posts: 815
Joined: Sun Sep 22, 2002 3:33 pm
Contact:

Apache Virtual Hosts

Post by fuuucckkers »

Ok... I got apache working.. but im trying to set up a subdomain for my phpBB message boards..
http://forums.myownworld.org
right now it's at http://myownworld.org/phpbb2
(by the way, the server is off..because i noticed a major flaw which exposes php code, if you structure the URL a certain way.. )

anyway... I have the VirtualHost section of the httpd.conf file as follows.

(Hiding IP for security reasons.)

<VirtualHost #.#.#.#:80>
ServerAdmin Webmaster@myownworld.org
DocumentRoot htdocs/phpbb2
ServerName forums.myownworld.org
ServerAlias forums.myownworld.org
</VirtualHost>

Now.. I went through the documentation plenty of times, I went through their examples.. and thats as best I understand it.
I could be wrong...and might not even have to use the VirtualHost for setting up a Subdomain.. but someone please tell me if I'm doing something wrong here.

Also.. it occured to me as well..that maybe the ServerName/Alias has to be the same as the folder name in the DocumentRoot and the DNS has to be set up for it as well. Well, I tryed it, and it still didn't work.
example..
DNS set to: phpbb2.myownworld.org
folder name: phpbb2
servername: phpbb2.myownworld.org
serveralias: phpbb2.myownworld.org

All the configuratin does right now, since it's obviously configured wrong... is displays my main site..but with the subdomain attached in the URL.

So I dont know what the hell I'm doing. IF anyone here is good with Apache configuration, please help me! :oops:
User avatar
RansomedCaptive
Newbie
Newbie
Posts: 16
Joined: Thu Aug 08, 2002 9:02 am
Contact:

Post by RansomedCaptive »

my setup in httpd.conf:
-------------------------------------------------------------------------------------
NameVirtualHost *

<VirtualHost *>
ServerName pickasmith.com
ServerAlias www.pickasmith.com w00t.no-ip.com
DocumentRoot "C:/Documents and Settings/daniel/My Documents/My Web Folder/wwwroot"
CustomLog "C:/Documents and Settings/daniel/My Documents/My Web Folder/access logs/access-root.log" combined
</VirtualHost>

<VirtualHost *>
ServerName daniel.pickasmith.com
ServerAlias www.daniel.pickasmith.com
DocumentRoot "C:/Documents and Settings/daniel/My Documents/My Web Folder/wwwdaniel"
CustomLog "C:/Documents and Settings/daniel/My Documents/My Web Folder/access logs/access-daniel.log" combined
</VirtualHost>
-------------------------------------------------------------------------------------
(note the "*" are not there to hide my IP, they are what i actually have in my config file.)

for my dns:
i added the CNAME Records
host: daniel.pickasmith.com
data pickasmith.com.
fuuucckkers
Moderator
Moderator
Posts: 815
Joined: Sun Sep 22, 2002 3:33 pm
Contact:

Post by fuuucckkers »

RansomedCaptive wrote: (note the "*" are not there to hide my IP, they are what i actually have in my config file.)

for my dns:
i added the CNAME Records
host: daniel.pickasmith.com
data pickasmith.com.
Yeah, I know what the Asteriks is for ... it's basically the same as the IIS way of doing it.. which is 'Use Any Unasigned IPs' that it may find on your network.

As for the DNS entry, you're actually suppose to set it up as an A Record..not a C Record. At least that's why my DNS host says.

The following is straight from the FAQ from my DNS provider.. http://zoneedit.com
A CNAME is not the simple "deliver this A record instead of that one" mechanism that they at first appear to be when most people are first introduced to the concept. In fact, CNAMEs are intended to redirect all DNS based traffic for one domain to another. For this reason, it is a violation of the DNS protocol to have a CNAME and any other DNS record for the same domain name.

Here's why. It may seem a bit odd at first that if you have a CNAME redirecting "here.com" to "there.com", then that means you can't have a Mail Server (MX) record defined for "here.com" -- since that would be another DNS record for the same domain name "here.com" which is a violation. This is, in fact, the truth, and is also easily accounted for.

When an e-mail is sent to "root@here.com", the e-mail client requests the MX record for "here.com", and gets the CNAME instead. The e-mail client follows the CNAME to "there.com", and asks the DNS server at "there.com" for the MX record for "there.com"! The e-mail for "root@here.com" is then delivered to the mail server for "there.com", and that server had better be set up to handle e-mail for "here.com" or else that e-mail is going to get returned to sender!

It gets worse. Not all email clients understand this behavior of the DNS, so even if you set it up correctly, your email may get returned anyway! For this reason, if you set up a CNAME for the root of your domain, or if you set up a wildcard CNAME, you may not have any inappropriate MX records defined, and you will not receive technical support for e-mail related problems.

In addition, if your mail server is called "mail.anywhere.com", then you MUST NOT use a CNAME to define its IP address -- you MUST use an A record. Mail clients that send e-mail to "info@anywhere.com" will look for the MX record of "anywhere.com". They will discover that the mail server is called "mail.anywhere.com", and look for an A record. If a CNAME record is returned instead, the mail client will very likely not understand it, and return the e-mail to sender!
User avatar
RansomedCaptive
Newbie
Newbie
Posts: 16
Joined: Thu Aug 08, 2002 9:02 am
Contact:

Post by RansomedCaptive »

i am pretty much a far cry from understanding all the dns stuff in it's entirety.

to me, the part that you quoted comes across as only having application to mx (email).

i did some quick googling for "subdomain +cname". the couple of articles i skimmed talked about doing it the way i have set up.

my limited understanding is that i have an A record (A, short for address) to associate my domain name with my ip. for my subdomains, i have have a C record (C, short for conical) to associate/alias subdomains to my true domain. that way when someone wants to visit my subdomain they are pointed via the C to my true domain, and from the true domain via the A to my ip. at my ip (i.e., server) it's up to my webserver to determine what to do based on the (in terms of apache) servername that was specified.

...if i am misled in my limited understanding, i am open to correction.

all i really know is (1) how i have my mess set up (2) that my mess works.

hooray for mess!! :D

- - - - -
edit: fyi, i use dyndns.org
fuuucckkers
Moderator
Moderator
Posts: 815
Joined: Sun Sep 22, 2002 3:33 pm
Contact:

Post by fuuucckkers »

RansomedCaptive wrote:i am pretty much a far cry from understanding all the dns stuff in it's entirety.

to me, the part that you quoted comes across as only having application to mx (email).

i did some quick googling for "subdomain +cname". the couple of articles i skimmed talked about doing it the way i have set up.

my limited understanding is that i have an A record (A, short for address) to associate my domain name with my ip. for my subdomains, i have have a C record (C, short for conical) to associate/alias subdomains to my true domain. that way when someone wants to visit my subdomain they are pointed via the C to my true domain, and from the true domain via the A to my ip. at my ip (i.e., server) it's up to my webserver to determine what to do based on the (in terms of apache) servername that was specified.

...if i am misled in my limited understanding, i am open to correction.

all i really know is (1) how i have my mess set up (2) that my mess works.

hooray for mess!! :D

- - - - -
edit: fyi, i use dyndns.org
Well .. Mess or not.. if it works, that's all that matters.
I've used DynDNS before.. but now (I Think) and other Dynamic IP services are starting to charge.. or use a demo app.. which sucks.

But I have a static IP with my cable modem / router setup..so I can use a real DNS :D
User avatar
RansomedCaptive
Newbie
Newbie
Posts: 16
Joined: Thu Aug 08, 2002 9:02 am
Contact:

Post by RansomedCaptive »

x Wasted Mind x wrote:I've used DynDNS before.. but now (I Think) and other Dynamic IP services are starting to charge
yea, i paid for it. one time for $30. i forked it out b/c i felt i could rely on it more than a free one, it was recommended by dotster.com where i registered my name at, and from using before with sites other than my own was pleased with it.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests