Virtualmin default admin domain

Hello all,

I have several virtual servers on a virtualmin box. All of them can access virtualmin administration using the port 10000. Ok.
I’ve installed a SSL certificate for one of the domain, and copied it to use with virtualmin administration. It works ok the domain I’ve installed the certificate, but the others give a message saying the certificate is for another domain.

The question is: is there a way to redirect all access on port 10000 to the domain I installed the certificate?
For example, I’ve installed the certificate on www.domain1.com . When someone accesses www.domain2.com:10000 virtualmin would redirect it to www.domain1.com:10000?

That way I would access virtualmin administration using only one domain, but with purchased certificate installed. I don’t give my customers access to Virtualmin, so I don’t have any problem using only one domain.
Is it possible?

Thank you

  • Rogerio

i believe this can be done using apache mod_rewrite rules,

eg:

RewriteEngine on
RewriteCond %{HTTP_HOST} =www.domain2.com:10000
RewriteRule ^(.*) https://www.domain1.com:10000/ [R]

i havent actually tried this for redirectin g vmin… but should work in theory. you would need to set this up for each vhost you have on the server. however can be added as a template under “server templates” and by editing “apache website”…that way any future vhosts get this rewrite rule automatically.

would be something like this i should think?

RewriteCond %{HTTP_HOST} =${DOM}:10000
RewriteRule ^(.*) http://www.${DOM}:10000/ [R]

Hi kthaker,

Apache is not listening on port 10000, so when I go to https://www.domain1.com:10000 Apache will not even know it, … right?

I’ll try your sugestion and post the results here.

Thank you
Rogerio

Howdy,

Virtualmin actually has native support for what you’re trying to do there – though it works by accessing admin.domain.com.

What you can do is go into System Settings -> Server Templates -> Default -> Apache website, and set “URL for admin redirect” to the URL for Virtualmin that you want to use.

That will apply to new domains added to your server.

To apply that to existing domains, you can run these commands on the command line as root:

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

That will setup a redirect within each Virtual Server you have so that browsing to admin.domain.com will redirect to your main Virtualmin URL.

-Eric

ahh, why yes you are correct about that! i completely forgot that port 10000 isnt from apache… sorry about that :slight_smile:

Great Eric,
Thank you

  • Rogerio