11 posts / 0 new
Last post
#1 Sun, 06/29/2008 - 22:50
mke

*.domain.com

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.

Sun, 06/29/2008 - 23:42
Joe
Joe's picture

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

--

Check out the forum guidelines!

Mon, 06/30/2008 - 00:26 (Reply to #2)
mke

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)

Mon, 06/30/2008 - 00:29 (Reply to #3)
mke

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

Thu, 07/31/2008 - 06:37 (Reply to #4)
Hans

<b>Joe wrote:</b>
<div class='quote'>I dunno. I don't think anyone has ever asked to create a &quot;catchall&quot; subdomain alias
</div>
What is so unusual about it? :)

<div class='quote'>
Neither of these things has a named option in the UI in Virtualmin, [...] So, still pretty simple, even if it's not a &quot;click a button&quot; kind of thing.</div>
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 &quot;force-rewrite&quot; all .conf files for all sites/servers in order to make the new/modified template take effect on all existing sites/servers?

Cheers,
Hans

Thu, 07/31/2008 - 13:17 (Reply to #5)
Joe
Joe's picture

<div class='quote'>What is so unusual about it? :)</div>

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

<div class='quote'>Why not simply allow *.domain.com when creating alias-(servers)? :)</div>

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, &quot;That'd be pretty easy to add...there I just checked it in. It'll be in the next release.&quot; 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 &quot;--all-domains&quot; 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 &quot;re-enable&quot; 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.

--

Check out the forum guidelines!

Thu, 07/31/2008 - 13:43 (Reply to #6)
Joe
Joe's picture

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..

--

Check out the forum guidelines!

Thu, 07/31/2008 - 14:04 (Reply to #7)
Joe
Joe's picture

<div class='quote'>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.</div>

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.

--

Check out the forum guidelines!

Thu, 07/31/2008 - 14:09 (Reply to #8)
Joe
Joe's picture

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

--

Check out the forum guidelines!

Fri, 08/01/2008 - 06:09
Hans

@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 &quot;re-configure (selected) sites&quot; or &quot;re-write config files w. updated/modified template&quot; 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 :)

Fri, 08/01/2008 - 06:52 (Reply to #10)
Joe
Joe's picture

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 ..

--

Check out the forum guidelines!

Topic locked