*.domain.com

  • mke
  • 06/30/08
  • Offline
Posted: Sun, 2008-06-29 22:50

I couldn't find on google how can I setup apache to handle these requests (pointing to the same location). Is there a certain place where to set a certain rule or should I get into the apache config files and alter them manually? Thanks.


Re:*.domain.com

  • Joe
  • 10/23/08
  • Online Now
  • Sun, 2008-06-29 23:42

I dunno. I don't think anyone has ever asked to create a "catchall" subdomain alias, and I've certainly never set one up. ;-)

But, you're obviously not the only person to want to do this, since Apache has syntax for it. According to the Apache docs, you can include wildcards in a ServerAlias directive:

http://httpd.apache.org/docs/2.2/mod/core.html#serveralias

So, add this to the domain.com VirtualHost section:

ServerAlias *.domain.com

And add a similar wildcard record to the BIND zone.

Neither of these things has a named option in the UI in Virtualmin, but if you wanted it to be standard practice for all of your virtual servers, you could just add the necessary line to the Server Template in the Apache and BIND sections. So, still pretty simple, even if it's not a "click a button" kind of thing.<br><br>Post edited by: Joe, at: 2008/06/29 23:43


Re:*.domain.com

  • mke
  • 06/30/08
  • Offline
  • Mon, 2008-06-30 00:26

Thanks! I altered /etc/apache2/sites-available/domain.com.conf changing ServerAlias lists.retailcop.ca to ServerAlias *.retailcop.ca

Hope it works (I wait for the DNS change to check that)


Re:*.domain.com

  • mke
  • 06/30/08
  • Offline
  • Mon, 2008-06-30 00:29

there is a bug that doesn't let me edit the post :)


Re:*.domain.com

  • Hans
  • 07/04/08
  • Offline
  • Thu, 2008-07-31 06:37

Joe wrote: I dunno. I don't think anyone has ever asked to create a "catchall" subdomain alias

What is so unusual about it? :)

Neither of these things has a named option in the UI in Virtualmin, [...] So, still pretty simple, even if it's not a "click a button" kind of thing. Why not simply allow *.domain.com when creating alias-(servers)? :)

I came across this post because I made a typo editing my template for *.domains. I meanwhile corrected that and could not find a more suitable topic here...

My question is: (How) Can I "force-rewrite" all .conf files for all sites/servers in order to make the new/modified template take effect on all existing sites/servers?

Cheers, Hans


Re:*.domain.com

  • Joe
  • 10/23/08
  • Online Now
  • Thu, 2008-07-31 13:17

What is so unusual about it? :)

I dunno. Nobodies ever asked for it and I've never done it. That makes it unusual to me.

Why not simply allow *.domain.com when creating alias-(servers)? :)

Good question. It wouldn't require any additional options in the UI, which is a total win. We would just allow a *.domain.tld in the name field. I have a loathing for new options, because we already have too many. So, whenever anyone asks for new options, my first instinct is to fight! Unfortunately, Jamie's first instinct is, "That'd be pretty easy to add...there I just checked it in. It'll be in the next release." But on this one, I think we can all be happy. ;-)

I'll ask Jamie to chime in on this thread with his thoughts, just in case I'm missing some obvious flaw in allowing this, without adding anything new to the domain alias form.

As for forcing a rewriting of all configuration files...BIND you can just disable and re-enable name service for the domains. From the command line you can use the "--all-domains" option to do it all at once. But Apache...I don't think you can disable the website for a virtual server, so no way to "re-enable" it with the new template. I'll leave it to Jamie to answer this one as well. It might take a one off script to get the job done.


Re:*.domain.com

  • Joe
  • 10/23/08
  • Online Now
  • Thu, 2008-07-31 13:43

Support for a *.domain.com virtual server shouldn't be that hard to add. There are some complications as normally the admin username and database name is based on the first part of the domain, and a user named * wouldn't work too well. I will add this to my TODO list though..


Re:*.domain.com

  • Joe
  • 10/23/08
  • Online Now
  • Thu, 2008-07-31 14:04

There are some complications as normally the admin username and database name is based on the first part of the domain, and a user named * wouldn't work too well.

You're making your life too hard, Jamie. Aliases don't have usernames. I don't think anybody wants a catchall Sub-server. At least, I certainly hope not.


Re:*.domain.com

  • Joe
  • 10/23/08
  • Online Now
  • Thu, 2008-07-31 14:09

Good point - since this is only really useful for alias domains, it becomes a fair bit simpler.


Re:*.domain.com

  • Hans
  • 07/04/08
  • Offline
  • Fri, 2008-08-01 06:09

@jamie Cheers! I am looking forward to see that *.domain option in next versions

@joe Cheers to you as well :) My question was ref. Apache, sorry if I have been unclear. But the idea you gave me helped: I disabled website (and in order to do so I had to also enable logfile-rotation and webalizer), re-activated and the .conf file was re-written.

No problem in my case as I only a couple of domains were affected by my previous typo in the template, but it would be nice if there was an option/button like "re-configure (selected) sites" or "re-write config files w. updated/modified template" somewhere, maybe in the templates section or in below the virtual server list.

Would come handy when s.o. has a large number of domains and wants to mod the template for them all w. one click.

Have agood weekend,

Hans :)


Re:*.domain.com

  • Joe
  • 10/23/08
  • Online Now
  • Fri, 2008-08-01 06:52

Yeah, being able to re-apply the template is on my TODO list. Although it will be effectively the same as turning off the feature and then turning it back on again ..