These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Server Alias not Resolving to correct virtual server on the new forum.
Hi,
I set up a virtual server for site1.co.uk. And successfully added a server alias ( site1.com )
I recently set up a virtual server for site2.co.uk. However, my server alias ( site2.com ) that I created as an alias of site2.co.uk resolves to site1.co.uk?
I wondered 2 things:
Is site2.com resolving to site1.co.uk because it's the first virtualhost on the server and basically the DNS is wrong or are both site1.com and site2.com doing this and I have not set-up server aliases correctly?
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.
Howdy,
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:
https://www.virtualmin.com/documentation/web/troubleshooting
If that doesn't help, let us know and we can do some more troubleshooting to figure out what is awry.
-Eric
Thanks Eric,
I have worked through the documentation...
error_log:
nothing stood out here other than a few file does not exist for a couple of images on both site1.co.uk and site2.co.uk
access_log:
Looking the the access_log for site1.co.uk I am getting lines showing site2.com such as: HTTP/1.1" 304 180 "http://site2.com/" "Mozilla/5.0
wrong site showing up:
Please note that in these blocks I can see no immediate reference to site1.com or site2.com as server aliases - I assumed these are 'pulled' in from somewhere else?
Network Settings:
Lewis
Howdy,
Please note that in these blocks I can see no immediate reference to site1.com or site2.com 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?
-Eric
Helloha,
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 site2.co.uk 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 site1.co.uk (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 site1.co.uk to site2.co.uk and both site1.com and site2.com now default to site2.co.uk.
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.
Questions
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,
Thanks again for input and hope that clarifies things for someone else.
Lewis
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! :)
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.
Hi,
Good to hear you resolved this. Sometimes it's the simple stuff that stumps us the most :-)
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
I solved this alias problem by: System Settings > Server Templates > Default Settings > Apache website > create alias website by: create permanent redirect virtual host.