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?

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

Rick

The “Webmin-y” way isn’t actually all that different:

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

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?

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.

STG wrote:

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

Rick

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 “routing” or “tunnelling” 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 “Subscribe” button for forums (only exists for threads), e.g. I would like to subscribe to any new thread in announcements forum.

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

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

Howdy,

There’s an option in System Settings -> Server Templates -> Apache Website for handling this now.

In that, you’ll see both “Redirect webmail.domain to Usermin” for Usermin and “Redirect admin.domain to Virtualmin” 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 :slight_smile:
-Eric

Howdy,

There’s an option in System Settings -> Server Templates -> Apache Website for handling this now.

In that, you’ll see both “Redirect webmail.domain to Usermin” for Usermin and “Redirect admin.domain to Virtualmin” 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 :slight_smile:
-Eric