Why does Ubuntu 20 default to one domain when IP is used
I have two different domains in public_html… call them domain-1 and domain-2
If you enter the Linode assigned IP address into the browser, it is domain-1 that always comes up.
Why does it default to that?
Is there a way to default it to domain-2
Is there a way to default to a screen saying "Access by IP entry not allowed" or something like that?
Thanks.
1 Reply
I have two different domains in public_html… call them domain-1 and domain-2
If you enter the Linode assigned IP address into the browser, it is domain-1 that always comes up.
- Why does it default to that?
This behavior is probably a function of your web server…not the OS. Since the web server has no way to discriminate between domain-1 and domain-2 if all it has is the IP address, it probably just picks the first site configuration it finds…which, in your case, is for domain-1…and serves that site.
- Is there a way to default it to domain-2
Try putting the configuration for domain-2 ahead of the configuration for domain-1.
- Is there a way to default to a screen saying "Access by IP entry not allowed" or something like that?
Probably. Consult your web server documentation…you probably need a mod_rewrite rule on HTTP_HOST…and put whatever you come up with in terms of configuration AHEAD of the configuration for both domain-1 and domain-2. Do a search on serverfault.com.
-- sw