squirrelmail globally under subdomain of each site

For a few days I have been trying webmin and virtualmin. It works like a breeze. I installed squirrelmail and it went ok. At the moment I am trying to find a way to install globally under a subdomain like http://webmail.mydomain.com - that is whenever I create a web site I want a webmail sobdoamin like above to be created for new site. I tried to add lines below to "Directives and settings for new websites"

<VirtualHost *:80>
DocumentRoot /usr/share/squirrelmail/src
ServerName webmail.${DOM}

But it gave error… later I realized it should not be there… and tried to find elsewhere… but could not find. when I add it manually it seems work…

Anyway, I like to learn:

  1. Am I on the right way to achive what I want?
  2. Is there a place to add the code above so it will be available globally
  3. I want the squirrelmail full url not shownlike "http://mydomain/squirrelmail/src/login.php" in the browser, instead I Like to have "webmail.domain.com" Do I have to use rewrite url to achive this?

Thanks in advance

Hmm, well, a few thoughts:

  1. If you’re using a typical Virtualmin setup, you’ll have trouble getting things to work in a DocumentRoot outside of /home. My suggestion would be that if you want to use Squirrelmail, you first create a new Virtual Server for it – something like squirrelmail.yourdomain.com, and setup Squirrelmail within the public_html directory it creates for you.

This will create a centralized install of Squirrelmail that will allow it to be available for all users.

  1. You can have it so that any user who types "webmail.theirdomain.com" will end up at this central Squirrelmail install. To do that, go into System Settings -> Server Templates -> Default -> Apache Website, and modify "URL for webmail redirect".

  2. If you create a single Virtual Server for your Squirrelmail install, you can make the name anything you want. You shouldn’t need to use any fancy rewriting unless you’re trying to do something particularly unusual :slight_smile:

Have a good one,

Eric’s advice is spot-on for the easy ways to do this, but I’ll add one thing that may not be immediately obvious about the way you’re trying to do this:

Suexec will not allow a central installation to run within the VirtualHost sections of your virtual servers. The files in the central installation are owned by the Apache user…so suexec tries to run them as the Apache user, but Suexec refuses to allow that to happen, because the SuexecUserGroup doesn’t match the Apache user.

Make sense?

If you must have it work this way, you’ll need to create a special non-suexec VirtualHost for running SquirrelMail.

BTW-Can I get your thoughts on why you prefer SquirrelMail to Usermin? I’d like to know what we’re doing wrong (I bugged people a few years ago about this, and we introduced the framed theme that give Usermin a more “mail client” appearance), but that doesn’t seem to have convinced everybody. So I’m going to bug folks again about why they’re choosing Squirrel over Usermin. (We’re not going to beat you up about it. I just want to know how we can further improve Usermin.) :wink:

Hi again,
First of all, I should say I am not very skilled person about linux, webmin and virtualmin… I am only a person who loves learning - especially self learning… That is why I spent all the week setting up ubuntu, webmin, virtualmin, roundcube again and again trying to understand approach, logic and concerns behind them… I got impression that Webmin and virtualmin are really good products compared to other CPs and has more advantages… anyway,


I am trying the approach you suggested… but I have not finished completely yet… I should check a few things more


That suExec thing… my homework :slight_smile: I will keep in mind and learn about it.

Why do I choose squirrelmail over usermin? Personally I do not have any preferences about webmail client… I prefer using mail client on my computer… I will share my observation in case it gives an idea.

Last week, while surfing to find comperative information about CPs I met someone saying "ugly virtualmin" and I deduced virtualmin must be good (since I am aware that most of the end-user-type people are after appearance more than function) and Now I am sure webmin&virtualmin are really functional and do meet more than needs. And I observed people mention roundcube "elegant".

Bearing in mind the attitudes of end users, I can say if the inward nature of virtualmin & usermin is combined to simplicity and attractiveness (which is seeked for by most people) I am sure most of them will prefer using this indispensable duo.

fine intelligence and labour behind them is clear but - concerning end users- it needs to be integrated into simple and more attractive form.

One more thing, most of the world is accustomed to using outlook type or yahoo type clients… habits

Sorry for the double post… I do not know why it posted twice

Eric, it seems to work… thank you for your close interest and suggestion… now I will try Joe’s spot about suExec…

when I enter "webmail.domain.com" it redirects url of central installation… so in the adress bar it is shown "squirrelmail.anotherdomain.com" I think this is the expected result of this method? is it possibel to have webmail.domain.com instead of redirect url… so users feel they are in their own site.

Yeah, redirecting to the central installation is the expected result of that method. Apache is watching for requests going to "webmin.domain.com", and when it sees it, it redirects to the central install.

While there’s probably ways to not redirect, I don’t know of a simple way of doing that off the top of my head.

However, I might actually suggest going a different route.

Rather than trying to avoid the redirect – I might go a step in the other direction and actually setup an SSL certificate for your centralized webmail install to secure it for your users and make sure their passwords aren’t being transmitted in cleartext. Seeing that padlock can also add warm fuzzies for users :slight_smile:

You could either use a free self-signed certificate, or you could pay GoDaddy about $30 a year for a commercial certificate (which won’t generate warning messages).

Here I tried another way.

Webmin -> servers -> Apache Webserver
Create virtualhost

Specific Adress: IP


Server name: subdomain.domain.com

Document root : Directory where Squirrelmail resides (In our case, it is on another host created for mail client)

Add virtual server to file:
New file under virtual servers directory /etc/apache2/sites-available

Copy directives:Nowhere

It seems this option gives us not to enable squirrelmail for all sites as default as we do not redirect from "server templates -> Default settings" What I like to learn: Does this approach breaks anything in virtualmin?

It seems this option gives us not to enable squirrelmail for all sites as default as we do not redirect from "server templates -> Default settings" What I like to learn: Does this approach breaks anything in virtualmin?

Does it break anything? Probably not, but I haven’t tried creating a Virtual Server in that manner, so I’m not sure if there’s any hidden gotchas :slight_smile:

If you’re able to add additional Virtual Servers and things seem to work, then you’re in good shape!