subdomain for usermin instead of portnumber

10 posts / 0 new
Last post
#1 Mon, 03/03/2008 - 10:28
palcrypt

subdomain for usermin instead of portnumber

Is there a way I can set up my various virtual hosts so that they can get to usermin by going to webmail.thedomain.com instead of www.thedomain.com:20000?

Fri, 06/06/2008 - 03:50
STG

Just wondering if you were ever able to figure this out. We are not having any luck with it.

Rick

Sun, 06/07/2009 - 07:24 (Reply to #2)
andreychek

There may be a more "webmin'y" way of accomplishing this, but I have had luck doing this using mod_rewrite.

What you can do is add code to your httpd.conf file, which looks for a particular string in the url the browser is going to, and if it exists, redirect to another url.

So in this case, take the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^webmail\..*$ [NC]
RewriteRule ^(.*) http://your_domain.com:2000

The above will look for url's beginning with "webmail.", and upon seeing it, will redirect to "your_domain.com:2000".

You can of course explore how to use $1 rather than hardcoding "your_domain.com" if you want to preserve the domain name the user typed in.

More docs on mod_rewrite here:

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

Good luck!
-Eric

Sun, 06/07/2009 - 07:24 (Reply to #3)
andreychek

There may be a more "webmin'y" way of accomplishing this, but I have had luck doing this using mod_rewrite.

What you can do is add code to your httpd.conf file, which looks for a particular string in the url the browser is going to, and if it exists, redirect to another url.

So in this case, take the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^webmail\..*$ [NC]
RewriteRule ^(.*) http://your_domain.com:2000

The above will look for url's beginning with "webmail.", and upon seeing it, will redirect to "your_domain.com:2000".

You can of course explore how to use $1 rather than hardcoding "your_domain.com" if you want to preserve the domain name the user typed in.

More docs on mod_rewrite here:

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

Good luck!
-Eric

Sun, 08/24/2008 - 10:39 (Reply to #4)
beat

<b>STG wrote:</b>
<div class='quote'>Just wondering if you were ever able to figure this out. We are not having any luck with it.

Rick</div>

That's really nice command, but it just does redirect to port 20000.
In quite some situations only port 80 and 443 are authorized by corporate firewalls, and a local &quot;routing&quot; or &quot;tunnelling&quot; or server-side include or sort of natting from domain webmail.domain.com (ports 80 and 443) to domain.com:20000 would be much better.

Any chance to see that in a future version of webmin ?

PS. I don't see a &quot;Subscribe&quot; button for forums (only exists for threads), e.g. I would like to subscribe to any new thread in announcements forum.

Sun, 06/15/2008 - 12:18
Joe
Joe's picture

The &quot;Webmin-y&quot; way isn't actually all that different:

http://doxfer.com/Webmin/UnderApache#Webmin_Proxied_Through_Apache

--

Check out the forum guidelines!

Thu, 08/07/2008 - 07:12 (Reply to #6)
staticanime

Is there any way to do it, so that if a user goes to http://usermin.theirdomainname.com, they'll be brought to the Usermin login, using just the one Default host?

For example, User A goes to http://usermin.sitea.com and User B goes to http://usermin.siteb.com, and both actually get sent to port 20000 of the server they're on?

Sun, 06/07/2009 - 07:27 (Reply to #7)
andreychek

Howdy,

There's an option in System Settings -&gt; Server Templates -&gt; Apache Website for handling this now.

In that, you'll see both &quot;Redirect webmail.domain to Usermin&quot; for Usermin and &quot;Redirect admin.domain to Virtualmin&quot; for Virtualmin.

Although that's just for new domains, the code they're using for that is pretty straight forward:

[code:1]
RewriteCond %{HTTP_HOST} =webmail.sitea.com
RewriteRule ^(.*) https://sitea.com:20000/ [R]
[/code:1]

I think I recall Joe mentioning a way to apply new template settings to existing domains, but I've never tried it nor do I recall what it is :-)
-Eric

Sun, 06/07/2009 - 07:27 (Reply to #8)
andreychek

Howdy,

There's an option in System Settings -&gt; Server Templates -&gt; Apache Website for handling this now.

In that, you'll see both &quot;Redirect webmail.domain to Usermin&quot; for Usermin and &quot;Redirect admin.domain to Virtualmin&quot; for Virtualmin.

Although that's just for new domains, the code they're using for that is pretty straight forward:

[code:1]
RewriteCond %{HTTP_HOST} =webmail.sitea.com
RewriteRule ^(.*) https://sitea.com:20000/ [R]
[/code:1]

I think I recall Joe mentioning a way to apply new template settings to existing domains, but I've never tried it nor do I recall what it is :-)
-Eric

Thu, 08/07/2008 - 10:36
Joe
Joe's picture

In Virtualmin Professional here is a virtualmin command to make the switch:

virtualmin modify-web --all-domains --webmail

I think that'll do it. The modify-web command isn't available in Virtualmin GPL, so I don't think it can be done automatically for existing domains.

--

Check out the forum guidelines!

Topic locked