wildcard on subdomain (only on subdomain)

majdaddin

New member
Joined
Apr 25, 2010
Messages
3
I created a subdomain proxy.domain.com and now I want to add *.proxy.domain.com to the same VHost. How?
If I add a *.proxy.domain.com or *.|DOMAIN| to the custom httpd config, DA adds it to ALL domains and main domain of domain.com (there are several subdomains and one main domain). I want the wildcard to apply only to ONE subdomain.

If I may add: it would be lovely if custom httpd configuration were configurated per VHost, instead of per domain. Since one domain can have several VHosts, it just doesn't make sense right now.

(Maybe I'm running an old DA. How can I check?)
 
when you create a subdomain in DA, it already creates a separate <VirtualHost> entry in the custom httpd configuration area (scroll down, you'll see it in there). You can add your wildcard in there.

You can check what version you are running by going to the Admin area and clicking on Licensing/Update. You'll see something like:

Compiled on Debian 5.0
Server Version 1.35.1
Current Available Version 1.351000
Last Updated Mon Apr 12 09:31:36 2010

You can also see the version in the Title Bar of your browser.
 
Hello,

Related for global VirtualHost customization:
http://help.directadmin.com/item.php?id=2

Related for wildcard subdomains:
http://help.directadmin.com/item.php?id=127

Regarding overriding existing values with the * character, you can create a subdomain name zzzzz, which will show up last in the httpd.conf.
In your customization, use:
Code:
|*if SUB="zzzzz"|
    ServerAlias *.|DOMAIN|
|*endif|
which will put the wildcard at the very end. You can make changes to the |?DOCROOT=/path| inside that |*if| as well, so set the zzzz path to where you want the * to go. Else just put your wildcard index file in the public_html/zzzz directory (probably simplest)

John
 
ranz, I know a separate VHost is created :) That's what I said. I also said the custom addition (eg "ServerAlias *.proxy.domain.com") is added to ALL VHosts (more than 2 for domain.com in my case). And that's the problem: the first VHost (www.domain.com) matches the new ServerAlias, instead of the right one (the 2nd or 3rd I think) (proxy.domain.com).
 
Admin, thanks for the code. This did the trick:
|*if SUB="proxy"|

ServerAlias *.proxy.onderstebuiten.nl

|*endif|

I didn't know you could 'script' in the customization... Cool. I now also understand the customization is 'executed' for every matching VHost, instead of just added to them all. Pretty nifty stuff.

Gotta ask though: I'm logged in as server admin (have to be for this function, right!?), so why not just let me edit the VHosts??
 
Back
Top