Server Alias not Resolving to correct virtual server


I set up a virtual server for
And successfully added a server alias ( )

I recently set up a virtual server for
However, my server alias ( ) that I created as an alias of resolves to

I wondered 2 things:

  1. Is resolving to because it’s the first virtualhost on the server and basically the DNS is wrong or are both and doing this and I have not set-up server aliases correctly?

  2. Where in the shell can I find virtualmins server alias configurations? When I look at sites-enabled it only lists the main servers ( with no mention of server aliases in their config ) on either of my two sites?

Any assistance would be appreciated.


Take a peek at the document here in the section “the wrong site shows up”, that should assist you in figuring out what’s going wrong there:

If that doesn’t help, let us know and we can do some more troubleshooting to figure out what is awry.


Thanks Eric,

I have worked through the documentation…


nothing stood out here other than a few file does not exist for a couple of images on both and


Looking the the access_log for I am getting lines showing such as:
HTTP/1.1" 304 180 “” "Mozilla/5.0

wrong site showing up:

  • My primary server is listed as eth1
  • This matches the IP address showing in the virtualhost blocks (/etc/apache2/sites-enabled/) for both &

Please note that in these blocks I can see no immediate reference to or as server aliases - I assumed these are ‘pulled’ in from somewhere else?

Network Settings:

  • Network interface for virtual addresses - set to primary server (eth1)
  • Default virtual server IP address - set to default “From Network Interface”
  • Default IP address for DNS records - set to “Same as virtual server IP”. I’m not sure if behind a NAT router or not - should I assume not?



Please note that in these blocks I can see no immediate reference to or as server aliases - I assumed these are ‘pulled’ in from somewhere else?

Hmm, if you go into System Settings -> Server Templates -> Default -> Apache Website, what is “Create alias websites by” set to?



System Settings -> Server Templates -> Default -> Apache Website

“Create alias websites by” is set to “Adding ServerAlias to parent”

I have attached the code block for for reference.
Please Note no .com in there although virtualmin reports it as I would expect.

Just as an aside (and possibly a noobie question):
If both server aliases were not set up properly, would they just resolve to the primary IP Address? - Which when I enter into the address bar - it resolves to (possibly as this is the first virtualhost code block)?

Having continued to try and resolve this over the weekend I can confirm that my server aliases are pointing to the “default domain” and not their respective ‘parent’ servers.

I switched the default domain in Server Configuration > Website Options from to and both and now default to

It almost feels like a permission based issue - but I don’t have the knowledge authority to be so bold.

It’s a small discovery I know but hope this helps.


Is there a way I can check this?
Are there any configurations I should be looking at?

Hello Folks & Thanks Andreychek for your input.

The issue turned out to be a simple misinterpretation of a feature.
In creating the server alias I was unchecking Set up website for domain?

This was based on my interpretation of the help file which is written as follows:

Set up website for domain?

The module can create any or all of the following services for a new domain: mail, name service, web service. If this option is set to Yes, a new VirtualHost configuration section will be added to the Apache configuration and a new website home directory will be created.

My rationale was,

  • I don’t need a new website or home directory - it will resolve to an existing one
  • I dont need a new configuration section - I need to amend an existing one.

Thanks again for input and hope that clarifies things for someone else.



Good to hear you resolved this. Sometimes it’s the simple stuff that stumps us the most :slight_smile:

Thanks for taking the time to outline this in detail, it helps other users that could be having the same problem. Far too many people just solve something and then leave without a word. You are one of the good guys! :slight_smile:

Thank you so much for posting this!

This was my exact issue as well. My server alias for my second site was redirecting to the default website, and when I checked “DNS domain enabled” and “Apache website enabled” everything worked properly. I’m not really sure why these are “features” when the alias just doesn’t work without them enabled.

Thanks for posting this. The workflow for creating a domain alias should be simplified somehow to avoid users making this mistake. For a start an explaining text next to “Set up website for domain”: like “Leave this checked if you want your alias to point to an existing website” or similar.

Just adding my name to the list of those who benefited from this post.

Thank you.

I solved this alias problem by:
System Settings > Server Templates > Default Settings > Apache website > create alias website by: create permanent redirect virtual host.