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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sub domain creation in apache virtualhosts

Status
Not open for further replies.

rninja

Technical User
Apr 11, 2001
381
US
I was just wondering how you go about adding subdomains in virtualhosts. I tried adding ServerAlias subdomain.domain.com to my virtualhost containers, and a DocumentRoot directive but they didn't work. I got the blank subdomain page instead of the main domain page.
how do you actually create vitualhost subdomains? Can you? I found no documentation on this.

Thanks,

Rninja
 
Did you find your answer to the sub-domains question?

I have done exactly as you and I have nothing int he Apache docs

Any help would be appreciated?
 
You will need an entry in your DNS server as well as your in your Apache config file. DNS will be used for any name that you would like to add "in front" of other names.
i.e.
user1.domain.com
---------------------
So, DNS will look something like this:

user1.domain.com. IN A 24.1.2.3

(depending on the flavor of DNS server, of course)

Step 2: requires entries in your <VirtualHost> section of httpd.conf

i.e.

<VirtualHost>
ServerAlias user1.domain.com domain.com
DocumentRoot &quot;/usr/local/apache/htdocs/domain.com&quot;
ErrorLog /usr/local/apache/logs/domain.com-errors
ServerAdmin admin@domain.com
ServerName domain.com
</VirtualHost>


good luck!

I HATE BEING A NEWBIE!
-grumpy smurf
 
Thisis an old question! Thanks for the responces though. I've done this.



Rninja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top