Submitted by craigh on Fri, 09/01/2017 - 15:31 Pro Licensee
I am setting up a domain with about a couple of dozen domains aliased (only web aliases, not email) to it on its old system. On the old system an A record is pointed at the web server's IP address, and the extra domains are then aliased using the Apache server directive "ServerAlias". Quick and easy, and a "RewriteRule" is used to ensure that only the primary domain is actually served to browsers.
Without trying I am assuming that I can do the same on the Virtualmin server (Services | Configure Website [for SSL]), but I'm wondering if there is a reason I shouldn't do it this way, instead going through the laborious process of adding each alias through Virtualmin.
Thanks.
Craig
Status:
Active
Comments
Submitted by craigh on Fri, 09/01/2017 - 15:40 Pro Licensee Comment #1
While I'm on this topic, actually, why are there separate configurations for SSL and non-SSL websites? I'm generally in favour of more choices rather than someone making them for me by reducing the number of options (to a point), but these days it doesn't seem to make sense to double the amount of configuring one has to do if (as has been my experience for years) the SSL and non-SSL websites are one and the same.
I'm not saying that I can't imagine a need to have two different configurations, but perhaps there could be an option for the server administrator to have a choice as to whether or not virtual servers are set up with the ability to have both SSL and non-SSL configuration files, or if they should be combined.
Craig
Submitted by andreychek on Fri, 09/01/2017 - 23:42 Comment #2
Howdy -- let's start with your question in your first comment.
I just wanted to verify, would it work to use an alias server for what you're after?
That is, if you go into Create Virtual Server -> Alias Server, you can have it added to your system as an Apache alias.
Would that do what you're after, or is there additional functionality you're trying to get?
Submitted by craigh on Sat, 09/02/2017 - 06:27 Pro Licensee Comment #3
Hi Eric,
Thanks for your reply. Yes, using Virtualmin to click around, type in required input and create an "alias server" (as you describe) would work, but that's the "laborious" process to which I referred in my original comment that I am trying to avoid.
I am not looking for any additional functionality, just a straightforward web alias, and I'd prefer to do it by copying and pasting Apache directives from the old configuration file as I described above rather than (as I say) clicking around endlessly (I'm on a slow connection, but I'd be asking this question even if I was on a fast connection) adding the Virtualmin "alias server" functionality.
So I'm asking (a) if doing what I want to do (copying and pasting from the old Apache configuration file) will do the same thing as the Virtualmin "Create Virtual Server -> Alias Server" process, and (b) if there is any reason I shouldn't do this, any drawbacks. Thanks.
Craig
Submitted by andreychek on Sat, 09/02/2017 - 09:04 Comment #4
Ah, I think I better understand what you're asking now, thanks for the explanation. Slow connection issues can be frustrating though, we do get that.
I'll offer that I believe it takes a lot more clicks to go into Services -> Configure Website, open the Apache config, then copy and paste a line in, than it does to have Virtualmin create an alias.
It only took me 4 clicks to create an alias in Virtualmin, and doing so opens fewer screens.
Another option though, especially if you're on a slow connection -- if you didn't wish to use the GUI, maybe it'd be even easier to do it on the command line?
For example, you could use a command such as this:
virtualmin create-domain --parent PARENT_DOMAIN.COM --alias ALIAS_DOMAIN.COM --web
I think that would do what you're after.
Now, regarding your question, could you just copy and paste the ServerAlias line into the Apache config -- yes, that will work if that's really what you wanted.
I suppose to us, it seems like a lot more effort than creating an alias, but if you want to copy and paste that line into the Apache config, that'll certainly work.
Submitted by craigh on Sat, 09/02/2017 - 11:07 Pro Licensee Comment #5
Thanks for your reply. I think the other part you missed in my opening comment was that I have a "couple of dozen domains" that I need to alias to one domain, not just one domain to alias to one domain. That's the whole reason for the question and my reference to "endless clicking" on a slow connection. One alias (four clicks) is not a problem.
So it seems that either I can copy and paste one long, ready-made ServerAlias directive into the Apache configuration file through Virtualmin, or write a small script to cycle through the list of aliased domains and do it through the Virtualmin CLI. When I get back to it I'll make a decision.
In addition to my other additional question (about why there are (by default) two places to configure Apache for SSL and non-SSL sites), I'd like to suggested that there be an option when aliasing example.net to example.com to configure Apache to do a 301 redirect to example.com, rather than loading the website under example.net.
Submitted by JamieCameron on Sat, 09/02/2017 - 15:45 Comment #6
If you need to create multiple domains at once, one option is to use the page at Add Servers -> Batch Create Servers.
You can enter lines formatted like :
aliasdomain1.com::::realdomain.com::realdomain.com
aliasdomain2.com::::realdomain.com::realdomain.com
etc..
Submitted by craigh on Tue, 09/05/2017 - 17:49 Pro Licensee Comment #7
For the record, I went the copy and paste the existing ServerAlias route, rather than cluttering up the Virtualmin interface with a long list of aliased domains that don't need any functionality in the control panel.
Can I have some feedback on these previously posted questions/comments?:
Submitted by JamieCameron on Tue, 09/05/2017 - 20:31 Comment #8
This is due to the way Apache's port 443 and port 80 configuration works - they are separate blocks in the Apache config.
Submitted by craigh on Wed, 09/06/2017 - 17:52 Pro Licensee Comment #9
Ah, right, OK. Still a pain, but I suppose that it will stay that way until Apache changes.