This is a static archive of the old Zorin Forum.

The information below may be outdated. Visit the new Zorin Forum here ›

If you have registered on the old forum, you will need to create an account on the new forum.

How to set up hosts file/s for multiple sites

ozstar

Sun Jan 05, 2020 12:39:52 am

Hi,

I am wanting to set up the host/s file for multiple sites however I am finding there are several methods and it is a bit confusing.

Any guidance please.

This is my default host file
Code:
127.0.0.1   localhost
127.0.1.1   david-HP-Compaq-6000-Pro-MT-PC

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


Would I just add our outside IP and the domain name of the site like so?

Code:
127.0.0.1   localhost
127.0.1.1   david-HP-Compaq-6000-Pro-MT-PC
202.***.***.***  www.sitenumber1.com    <<<<<<<<<<<<<<<<<<<<

Aravisian

Sun Jan 05, 2020 1:57:32 am

ozstar

Sun Jan 05, 2020 3:11:10 am

Yes and no. :-)

Yes because this post is the server end of the domain nameserver setup and no because the link is about a setup in the Domain Registry admin area for the domain name.
I made a separate post as I figure if anyone has to re-delegate a domain name to their home/office server, this is what they will need to get the name to point to the IP#

Aravisian

Sun Jan 05, 2020 4:45:19 am

ozstar wrote:Yes and no. :-)

Yes because this post is the server end of the domain nameserver setup and no because the link is about a setup in the Domain Registry admin area for the domain name.
I made a separate post as I figure if anyone has to re-delegate a domain name to their home/office server, this is what they will need to get the name to point to the IP#

True, but the lines:
"Note: A customer's own name server must have previously been set up on a dedicated (static) IP address."
"Domains can then be delegated to the new child name servers normally."

From your example above:
Code:
202.***.***.***  www.sitenumber1.com  www.sitenumber2.com  www.sitenumber3.com  www.sitenumber4.com  www.sitenumber5.com  www.sitenumber6.com  www.sitenumber7.com  www.sitenumber8.com  www.sitenumber9.com 
202.***.***.***  www.sitenumber10.com  www.sitenumber11.com  www.sitenumber12.com  www.sitenumber13.com  www.sitenumber14.com  www.sitenumber15.com

You'll want to use no more than 9 on a line. In this example, I put maximum 9 on one line then dropped down to another line to set up the "remaining sites."

I am ignorant on this topic as it has been many years and last I did any of this was on Windows. I know this does work when using your I.P. I think you want to use an outside I.P. As I understand it, it should work the same way.
I make suggestions in the hope it may help or point you in a direction that will. If I am wrong and it does not work the same way, please say so.

ozstar

Sun Jan 05, 2020 5:59:09 am

Your time, experience and help is really appreciated believe me and if it works great, if not we'll try something else. easy :-)

It is a very confusing subject and years since I did anything like it. My main gig at the moment is website hosting on shared servers with WHM and Cpanel so much of what I am trying to do here is automatically done on these shared servers. I delegate and redelegate all the time for site but the DNS is already setup on the shared server.

On looking at it, those instructions above from my Registry gives me a, 'child' dom name. For example one of the doms I have is say, example1.com, then this gives me... t mysite.example.com.
If I am thinking correctly this is not what I want.
I want the name example.com to resolve on my server. My static IP# does now resolve there, but I need the actual dom name to as well.

In overview I want to have several domain names served from my on static IP

So to do this I think I need to do at least 2 things..

Put the name example.com into my hosts file and

Enter a nameserver address into the admin area of example.com in the Registry. Usually ns1 and ns2, ns3 etc.

This is where I get lost :-(

I own the name, 'myownofficeserver.com' and I want to use it as the nameserver for all other domains I host.

I don't know if I'm seeing it correctly but I see it as a sort of 'triangle'. myownofficeserver.com at the top and splitting into all other doms I host via the host file.

Does this make sense?

Shame I can't find a clear tutorial that explains it all from wo to go. I have seen many but they say different things.

If you fall over a good one, please let me know.

Gotta go get a coffee after that !

ozstar

Sun Jan 05, 2020 6:33:33 am

Well amazingly, I found the Zone area in the Registry for my new name and changed the A to my outside IP#. I did both the name and www. I disabled the WiFi on my phone so it went through mobile and placed the new name in the browser and low and behold the Apache file showed up.

I have the new name in the hosts file as http://www.myofficeserver.com and myofficewebserver.com and an index file in a new directory but it is not resolving there. It is resolving in the html directory and not being redirected to its correct folder.

Any ideas how to get it to the correct directory?

If I add the folder to the address it does resolve in the directory

eg www.myownofficeserver.com/myownofficeserver

Swarfendor437

Sun Jan 05, 2020 6:04:20 pm

I'm more of an expert on the Desktop than server. All I could find using your query as part of the search criteria led to this site:

https://vitux.com/linux-hosts-file/

Aravisian

Sun Jan 05, 2020 6:07:07 pm

Ya know... I hope you do major back ups. By the time you get it all resolved and set up, you have forgotten half of what you did to get there. A power outage could set you back to a wipe and reload. Back up everything, including ROOT folders.

ozstar

Sun Jan 05, 2020 8:34:44 pm

Hi,

Yes I do a backup every day with the default backup program to another 500GB drive in the box. I

'd be a zillionaire if I had a buck for every drive I have lost for one reason or another. So really careful now on all my boxes.

Got data recovery down to an art too when needed.

I did get this error on the last back up. Could not back up..

/home/david/.dbus

Is this a necessary file to backup?

Thanks

Aravisian

Sun Jan 05, 2020 9:13:37 pm

ozstar wrote:/home/david/.dbus

Is this a necessary file to backup?

Thanks

No, that is one of those that you skip. It's specific to that particular installation.

ozstar

Tue Jan 07, 2020 7:11:11 am

Thanks