Forums / Installing on a Linux/Unix Server / Question on hosts file

Question on hosts file

Views: 2,225

Results 1 to 2 of 2
15 Apr 2023, 6:35 AM
#1
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Question on hosts file

I have a web server on my local computer and zen cart installed.
However it cannot be seen on the internet.
Here is the /etc/hosts file:

127.0.0.1    localhost
127.0.1.1    crosshair
127.0.0.1    zentest.com
127.0.1.1    crosshair.zentest.com crosshair

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

Now my question is, supposing I installed a Debian web server on a server connected to the internet and I already fixed the A record and everything. My IP would be something like 324.125.968.32, how should the hosts file read??

[argentiniansupermarket.com

](http://argentiniansupermarket.com)

17 Apr 2023, 3:31 PM
#2
ckosloff avatar

ckosloff

Totally Zenned

Join Date:
Feb 2007
Location:
South Florida, USA
Posts:
1,375
Plugin Contributions:
0

Re: Question on hosts file

SOLVED, answer is very simple: as I said this is a local test server so it is not visible on the internet, 127.0.0.1 is a loopback adress to same computer that is hosting the website.
It is usual that default files are installed upon installation of Debian, thus:
127.0.0.1 localhost, is the default and only line
BUT
if you want your site to show you must add a line:
my IP mysite.com
then reload web server: systemctl reload apache2.
DONE

[argentiniansupermarket.com

](http://argentiniansupermarket.com)