[Charlug] subdomain help/explanation
Lawrence Teo
lteo.charlug1 at calyptix.com
Mon Mar 17 17:02:04 EDT 2008
You can do this with the VirtualHost directive in Apache, something
like this:
<VirtualHost *>
ServerName domain.com
DocumentRoot /var/www/com/domain
ServerAdmin webmaster at domain.com
ErrorLog logs/domain.com-error_log
CustomLog logs/domain.com-access_log combined
</VirtualHost>
<VirtualHost *>
ServerName sub.domain.com
DocumentRoot /var/www/com/domain/sub
ServerAdmin webmaster at domain.com
ErrorLog logs/sub.domain.com-error_log
CustomLog logs/sub.domain.com-access_log combined
</VirtualHost>
Then you'll need to tell GoDaddy to point both domain.com and
sub.domain.com to the IP address of your webserver. Apache will
then decide which directory to serve depending on whether the
browser is asking for domain.com or sub.domain.com.
There are more steps to setting up virtual hosts but hopefully
the above will help get you started. Please backup your Apache
conf file first and document everything you do. :-)
PS: If you use /var/www/com/domain as the DocumentRoot for
domain.com and /var/www/com/domain/sub as your DocumentRoot
for sub.domain.com, that means that someone can access the files
for sub.domain.com by using http://domain.com/sub -- that may
or may not be what you want.
PS(2): The steps mentioned are for Apache on OpenBSD but it should
be generally applicable to Apache on Linux.
Hope it helps,
Lawrence
Lawrence Teo
Calyptix Security
704-971-8989
http://www.calyptix.com/
Rick Pasotto wrote:
> How do I set up a subdomain? Example:
>
> domain.com is a valid funtioning domain on my machine with root at
> /var/www/com/domain.
>
> I create a subdirectory /var/www/com/domain/sub
>
> Godaddy wants to know where to redirect sub.domain.com. Do I tell them
> http://domain.com/sub?
>
> What do I put in the apache sites-available file for the subdomain?
>
> I would like sub.domain.com to act just like a totally separate website.
> In other words, the address bar should have: http://sub.domain.com
>
> --
> "Personal liberty is the paramount essential to human dignity and human
> happiness." -- Edward George Bulwer-Lytton (1803-1873)
> Rick Pasotto rick at niof.net http://www.niof.net
>
> _______________________________________________
> CharLUG mailing list
> CharLUG at charlug.org
> http://charlug.org/cgi-bin/mailman/listinfo/charlug
>
More information about the CharLUG
mailing list