When I tried to reach out to the server that I named in nginx.conf, curl threw me an error:
curl myServerName.test:80
And then
"curl: (6) Could not resolve host: "
My nginx.conf
http{
server {
listen 80;
server_name myServerName.test;
return 200 "hello world!\n";
}
}
The curl could not reach the host. I had to edit the /etc/hosts.
sudo nano /etc/hosts
and then /etc/hosts appeared like below
127.0.0.1 localhost
# 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
And added the myServerName.test after a space tab near the localhost. the last state of /etc/hosts :
127.0.0.1 localhost myServerName.test
# 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
Tried the curl again
curl myServerName.test:80
Then
hello world!
Contact me
Top comments (0)