I ecountered the following issue about server_name in nginx and might need your help. This is my default.cnf resided in /etc/nginx/conf.d/
server {
listen 80;
server_name planner.dev;
root /var/www/planner.dev/src;
index index.php index.html index.htm;
...
}
And I have a helloworld html file in /var/www/planner.dev/src
However, only localhost will run, planner.dev will not run.
$ curl planner.dev
curl: (6) Couldn't resolve host 'planner.dev'
The problem is most likely in the system hosting the server, than in the server itself.
I was running an Nginx server on Debian and happened to have the same issue, which I solved by editing the /etc/hosts file likeso:
127.0.0.1 localhost
127.0.0.1 vacuum
127.0.0.1 <mywebsite>.localhost
More about the hosts file.
The issue is fixed by editing the hosts file of Centos, not relating to NGINX. Sorry everybody
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With