Solved

Dynamic subdomains to different vhosts

Posted on 2004-04-05
5
313 Views
Last Modified: 2010-03-04
With our current hanrdware setup, all the traffic goes through 1 IP address. We would like www.domain.com and domain.com to goto the standard directory (ie, /home/domain). All the dynamic subdomains (ie: foo.domain.com, bar.domain.com) should all point to /home/dynamicdomain/. How can I accomplish this?
0
Comment
Question by:dcman99
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
rrusch earned 250 total points
ID: 10761538
For Apache you just need a default virtualhost section. Normally the first in httpd.conf.
Additionally dns has to resolve *.domain.com to your ip.

--- Example httpd.conf ---
NameVirtualHost *
<VirtualHost *>
        DocumentRoot /home/dynamicdomain
</VirtualHost>

<VirtualHost *>
        ServerName www.domain.com
        ServerAlias domain.com
        DocumentRoot /home/domain
</VirtualHost>
0
 
LVL 10

Assisted Solution

by:Mercantilum
Mercantilum earned 250 total points
ID: 10857009
To my mind something is missing in the answer above,
Add
...
<VirtualHost *>
        ServerName foo.domain.com
        ServerAlias bar.domain.com xxx.domain.com
        DocumentRoot /home/dynamicdomain
</VirtualHost>

This way the 3 subdomains foo.domain.com, bar.domain.com and xxx.domain.com point to /home/dynamicdomain
0
 
LVL 10

Expert Comment

by:Mercantilum
ID: 10857014
And remove
<VirtualHost *>
        DocumentRoot /home/dynamicdomain
</VirtualHost>
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 11760893
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:

    SPLIT: rrusch, Mercantilum

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

Periwinkle
EE Cleanup Volunteer
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DNS Question 7 64
How to redirect https://www to non-www? 6 75
Apache SSL and mod_rewrite not working 8 157
Apache error.log 19 43
As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question