-1

I am going to attempt to rewrite the initial question so that it makes more sense.

The issue I was being faced with is that I have my Company's website hosted on Site Ground but unfortunately because of the site builder the use, they are unable to transfer is under a different Addon Domain in that domains Document Root. The reason I wanted to have it moved, was because I finally registered the Domain Name that matches my Company name. Currently that website was being accessed from a temporary Domain Name which I never planned to keep as the Domain name for my Company..

To avoid confusion, my Company's Name is Systopian Solutions. My Public Company Branded home page was being temporarily (or so I thought) run under the Document Root for the Domain Name "systopian.com". I had fully planned that once I got my proper Company Domain Name "systopiansolutions.com" that I could add that Domain as another Addon Domain in Site Ground, and then have the actual contents of the site transferred from one Addon Domain to another, both on Site Grounds Hosting.

However, in my initial thinking that the site could be transferred, and before I opened the original question that was here, even if that transferred it, I was left with a slight problem.

I also have e VPS Server Hosted by Vultr. This Server runs all of my Company's Public Facing Invoicing, Billing, and Payment Processing Web App Site (Invoice Ninja) as well as a couple Internal Web App Sites which allow me to provide different services to my Client,

SIDE-NOTE:(and while I am aware, you should never run Public Sites, and Internal Sites on the save server, I have implemented a number of steps to insure that no one will be able to go snooping around. For 1. I have set up Aliases for all of my Internal Sites URLs, so that not one of them uses the commonly known URLs, should they know those Sites are there. 2, Invoice Ninja has a very robust security implementation, that will not allow anyone to choose any fqdn/dir unless it is allowed by Invoice Ninja for the functionality of that product, however, by using the /etc/phpmyadmin/apache2.conf, which is formatted completely different from the way a /etc/apache2/sites-available/site-name.conf file is configured. The syntax is completely different, but for reasons I can not explain, if I need to install a new site, rather then using the site-name.conf which will cause Invoice Ninja to reject access to any of the DocumentRoot paths, I use the /etc/phpmyadmin/apache2.conf and goto the bottom under the phpMyAdmins Config where I then create a new tag section using the markers and place the appropriate paths, mods, paths, and all other config required by the new site, save, then restart apache2. I do however take the security one step further since we are mixing Public and Internal sites on the same server, by adding the use of the .htpasswd and forcing who may try to access some internal site they may find if they poke hard enough, they are Required to the credentials for 1 of the only 2 users which are configured in the .htpasswd. Should they satisfy those credentials some how, the Web Apps Sites themselves each have their own user management / Login credentials required to access those sites. While I am of no illusion that what I have done is impermeable, I can assure you that it would take one VERY determined hacker, which years of experience to hack into the internal sites. There are enough layers, and the passwords chosen, are VERY Strong with a minimum Char length and the right combo of #'s, Special Chars, Upper/Lower Chars)

The slight problem I had was that I wanted my VPS Server which was hosting some of my Company's Public Sites, such as invoice ninja, to use the new Company Domain of systopiansoltions.com. In the case where the transfer of my Company's Home Page had been transferred to the new Addon Domain on my Site Ground Host, that would mena that I would have to different Servers, that would somehow need to use the systopiansoltions.com domain. And this is what I was asking, is there a way where I can have my site hosted by Site Ground, which the DNS A Record would have a different IP Address for the A Record to point the systopiansoltions.com domain to the Site Ground IP of 37.60.253.172 while somehow also pointing the Same DNS Servers A Record for my VPS Servers Sites to the IP Addr of my VPS sites which is 207.246.87.29.

The initial questions was more or less, without having any kind of a load balancer or router setup, is there anyway to have the same FQDN pointing in some ways to 2 different IP addresses.

Some thoughts I had that could possibly help me do this in the cleanest way possible, would be somehow to setup redirects, though I am not sure how that would work.

So this was the detailed explanation of my problem and question.

There was a second part to this question, which I mistakenly asked with the incorrect information, so I will ask that as well...

Since the VPS Host contains both Internal Sites and Public Customer Sites, I was wondering if there is a way to configure 2 different Domain Names each to a site based it's function...

Example: On the VPS server, the /etc/hosts had the following entries, (I am not including the "localhost" entries). And this is how it was configured up until today. The problem is that now that I registered the proper Company Domain Name, I would love to be able to have the systopian-web1.com Domain Name used for all of the Internal Sites, while somehow configuring the Public Customer Facing Invoice Ninja Site to use the systopiansoltions.com domain, however, I don't have a 3rd IP to usem and frankly, I am short of any kind of any Operational Budget for a while, so I can not afford to add a 3rd IP which would make this problem disappear all together.

207.246.87.29 systopian-web1.com <--Primary IP

45.76.165.28 unms.systopian-web1.com <-- Secondary IP Added specifically for this app install as it required a dedicated IP Address.

So, my question is, is there anyway to use 1 IP with 2 different Domain Names? Of does anyone know of some other way to accomplish this?

I do know that in my apache2/sites-available/invoice-ninja.conf I can change the following entries: ServerName systopiansolutions.com ServerAlias www.systopiansolutions.com However, my initial thought was that in order to specify either of these two, the Domain Name needed to be defined in the /etc/hosts. Is that not the case? I am not sure how else these Domains would get resolved, since I know that I can not have two A Records where 2 Domain Names would point to the same IP address ie have stopiansolutions.com resolve to 207.246.87.29 and then have my other domain name on the same VPS Server systopian-web1.com point to the Same IP 207.246.87.29, unless I was able to update the /etc/hosts contain the following

207.246.87.29 systopian-web1.com <-- This Domain would be set for the internal websites that are used by me to provided functionality and services for my clients, but the Public does not have access to these sites

207.246.87.29 stopiansolutions.com <-- This Domain would be set for Invoice Ninja, since this is a Public Customer Facing Site, so I want all Public Customer facing sites, to use this domain.

45.76.165.28 unms.systopian-web1.com

And just to remind you, that what I had asked earlier is still an open question, and that is, since my Public Company's Home Page is currently hosted on Site Ground, would there be any way to use the same Domain Name on two completely different servers each of which has a very different IP?** I may have resolved this another way, but the question still stands.

Short of that, I only have one other option, but I will explain that in a rewrite of my own reply, if I can modify that, if not, I will add another Reply.

I have one friendly request, especially when you guys reply to someone who you can clearly see if very green on using this site. Rather then respond the ways some of you did, which honestly had pushed me to the point that I was going to just leave the site, as I felt that the responses showed complete lack of tolerance towards those who are new, and are not yet all to familiar with the way things are here, and I was fairly ignorant to the expectations that some of you seemed to have regarding to how questions are posted, etc, but instead, try to be welcoming, and either send them a private message, or reply to their post and share with them the link that was later shared with me, after it was made clear to me that Green members, and their not well written questions, are anything but tolerated. This would have given me quite the incentive to have taken the time that I am now to rewrite the question. Sometimes people get so wrapped up in themselves, that they forget how far a small gesture of kindness goes.

If not for one of the other members taking the time to try and make sense of my question, and doing his best to provide me with a different way to consider my issue, I don't know that I would have ever return back again, which would have been a shame because, like many of you, I have 2 decades of Tech Support, Application Support Engineering, Systems Administration, Web Services, and Foreign Systems Integration & Migration Engineering Architect . I am quite sure at some point, I would have been able to share some of my many years of experience to assist others that do not have the Skill Levels that I do in many areas, and I love to help people. So while I am not trying to beat a dead horse, I would just ask that you approach new members with a little bit of forgiveness and acceptance, and rather then drop the reputation of the first post they make, try to point the in the right direction (as was done again, well after the fact) so they can learn how to write the most effective post, rather then making them feel unwelcome, and alienated from the membership. Hopefully, both my questions and what I just explained makes a difference and hopefully, the next person will not feel as rejected as I.

If anyone has any questions regarding the questions I posed as rewritten, please feel free to ask.

Cheers,

John

John Durchak
  • 11
  • 1
  • 4

2 Answers2

1

You are probably confusing two concepts:

  • the canonical fully-qualified domain name as returned by hostname --fqdn. It is used by a server to know how to call himself, e.g. in the HELO command of SMTP.
  • the fully-qualified domain names of your websites.

In order to host systopiansolutions.com on your premises you don't need to change the canonical hostname of the server, just add an A DNS record that points to your server and configure an Apache <VirtualHost>. You don't have to change anything in /etc/hosts either, since the Apache2 server selects a site to serve based on the client's Host header, not the IP address of the incoming interface (actually I have to guess what are you trying to do with the /etc/hosts file, since you mention it only in the title of the question).

MySQL does use a hostname to identify the connecting user, but you are probably using localhost anyway.

Edit: After your clarifications, the answer to this question:

The initial questions was more or less, without having any kind of a load balancer or router setup, is there anyway to have the same FQDN pointing in some ways to 2 different IP addresses.

is quite straightforward: you can have as many A DNS records for the same domain as you like, provided that all the servers have the same content. If they don't, your users will randomly get one webpage or the other.

About the /etc/hosts file, 25 years ago it used to contain the same information as DNS and you could download from NIC the IP addresses and domain names of all Internet hosts. Obviously it does not work like this today. Today you use it only to override DNS (on UNIX-es /etc/hosts is consulted before querying DNS): e.g. usually (or historically) every host has just its short name like webserver1 in /etc/hostname and a line:

127.0.1.1 webserver1.example.com webserver1

which overrides the A record for webserver1.example.com, so that internal communication of the host with itself uses the loopback device.

Piotr P. Karwasz
  • 5,748
  • 2
  • 11
  • 21
  • Thank you!. Actually, I wanted to change /etc/hosts, because I needed all services, Apps, & SSL's to use the primary IP with the FQDN systopiansolutions.com & not whats commented out. I was (perhaps wrongly so) under the impression the certbot-auto used /etc/hosts to qualify the FQDN on a host. Either way, I got my certs now, and every Site, App and SSL's, DNS are now pointing to the new domain name. /etc/josts 127.0.0.1 localhost 127.0.1.1 systopian-web1 #207.246.87.29 systopian-web1.com 207.246.87.29 systopiansolutions.com 45.76.165.28 unms.systopian-web1.com – John Durchak Jan 19 '20 at 23:04
  • Piotr P. Karwasz - Thank you very much for your reply and taking the time to explain a couple of things for me. Once I have some time later, I will modify my reply to my own question that specifies exactly what I did to handle the situation I was in. Right now, I am working with 2 clients so I need to focus on them first. Thank you again. I really appreciate it. – John Durchak Jan 19 '20 at 23:17
0

While I was unable to find a suitable answer at this time, and the fact that it would appear that since Site Ground is unable to transfer my Company's Public Home Page to the Addon Domain added to them as systopiansolutions.com, I don't really have the questions pertaining to having 1 Domain Name resolving to 2 different IP addresses. So while I am still curious how, if at all, could that be done, or how would someone with that level of expertise deal with the same problem if their had it.

However, since there is now way for me to transfer the actual site, I decided that I would just create another ner Site on the VPS Server, and while that server already has Invoice Ninja (which is a Public Customer Facing Site) that I would maybe forget about trying to have the Domain Name in multiple places with Multiple IP's and rather just change the entire configuration of the VPS server, taking out the references to systopian-web1.com in /etc/hosts, and replace all entries for that domain name to that of systopiansolutions.com. This way, all sites, Public or not, will all point to the proper domain name for my company.

So I actually did follow through with that plan, and I not only updated my DNS which is being provided by Site Ground.

As well, I modified /etc/hosts, and commented out the entry for systopian-web1.com, and added the entry for systopiansolutions.com.

I went through each of my websites site-name.conf, as well as the apache2.conf, and I changed all of the ServerName and ServerAlias to use systopiansolutions.com.

I then rebooted my host to ensure all of my changes were committed to each of the areas as appropriate.

By doing this as well, I was able to get my SSL Certs for all of my sites to be provisioned, and installed for all of the sites using the systopiansolutions.com. Since this is a VPS server, I had to created the certs manually using certbot-auto, which if I understood how that cli program works, it validating your domain names, based upon the entries in /etc/hosts, not DNS.

Once the SSL's were installed, ALL sites, Public and Internal are working properly with the new domain, and with https.

However, I noticed a couple issues which while they are not hurting me at all, its a couple problems that hopefully someone can assist me with, as I hate to muck with anything while everything is working so perfectly. However, as I understand it, you may only have one FQDN in your /etc/hostname however, mine has two. Again, nothing is not working and not one thing is complaining. And while I have read that yes you can list more then one FQDN entry here, I read the Linux Man pages, which says, no, only one is permitted. Since I do not know what subsystems actually use this file for it's entiers, I am not sure exactly which Domain name should be configured here...

root@systopian-web1:/etc# cat /etc/hostname systopian-web1 <==== This is the localhost name. systopian-web1.com <==== This was the old FQDN for the server. and if possible, I would love to continue to use this to be the domain name for all of the Web App Sites that are just internal sites.

Now, in my /etc/hosts, we have a slightly different story, I swapped the Domain name for the server. However, unless someone knows how I can configure both Domain Names to be used on this same host, I am not sure what else to do. Since the Server, is not in anyway tied to my local network, I can not use the localhost entries in order to configure the Internal Sites to use LocalHost with the systopian-web1.com. So that wouldn't work either.

root@systopian-web1:/etc# cat /etc/hosts

127.0.0.1    localhost
127.0.1.1    systopian-web1
//207.246.87.29 systopian-web1.com
207.246.87.29 systopiansolutions.com
45.76.165.28 unms.systopian-web1.com
//The following lines are desirable for IPv6 capable hosts
::1          localhost ip6-localhost ip6-loopback
ff02::1      ip6-allnodes
ff02::2      ip6-allrouters

The other issue is that I want to keep the 127.0.1.1 hostname to systopian-web1 in order to keep with my Operations Center Server Naming convention. Hence the

/etc/hosts shows:
127.0.0.1    localhost
127.0.1.1    systopian-web1

So hopefully I have better explained what I had done to get around the worry about having 2 IP Addresses pointing to the a single domain name, since one of my first thoughts on how to handle these issues brought up in my newly written question post, is no longer an issue and since I will be working on creating my Company's Home Page, on the VPS Server, which is now configured with the systopiansolutions.com domain name, there is no longer a need (other then the simplicity of setting up a site using Site Grounds free Drag and Drop Site Builder), to have my Company's home page hosted on Site Ground.

John Durchak
  • 11
  • 1
  • 4
  • You might want to read [the help section on how to ask a good question](https://serverfault.com/help/how-to-ask), it will help you to write questions in the future that are received better. – Gerald Schneider Jan 19 '20 at 15:15
  • And yes, I downvoted your "answer" as well, because it contains nothing that actually answers your question in a way that would help others, it's mainly a rant. If you clean up both your question and your answer, removing everything that's not relevant to the topic, I'll reverse my votes. – Gerald Schneider Jan 19 '20 at 15:17
  • Rather then downing it, why not simply do what you did now, which is take the time to explain why you did not find my response to my own question satisfactory, and try to be helpful rather then knocking it down. If someone would have told me that the information that I provided in my followup response does not provide enough information to make it useful the others, then perhaps I would have been more then happy to edit my response and try to make it more informational. Since my original questions w-1'ed didn't bother providing specific details as it seemed my question itself was poor. – John Durchak Jan 19 '20 at 23:11
  • If anyone would like me to edit my post, and specify exactly what I did that allowed me to over come my issue, I would be happy too. However, sometimes it just more polite to provide some constructive criticism so that people understand what they didn't do correctly. But just knocking it, then not actually telling me why until hours after I went on a rant since the responses were less than helpful. Many people like myself learn from there mistakes, and I would much prefer someone tell me what was wrong so that I could learn rather then respond with just as useless replies. – John Durchak Jan 19 '20 at 23:15
  • In an effort to improve my Question and Reply's reputation, I have taken the time to go though them both and completely rewrite them. Hopefully you guys will find the revisions much more detailed, and much better explained as far as what I was trying to do and why, and then in the response, explain what I did to work around having to worry about setting up some confusing configuration that would like cause more problems then was already there. Hopefully, I have provided a question and response worthy of some review. – John Durchak Jan 20 '20 at 10:26