I have installed nginx version: nginx/1.17.10 (Ubuntu). The index page which is pointed by "default" configuration file in "sites-enabled" directory works properly. I have created another configuration file in "sites-enabled" called "test.com" and it looks as :
and
i have placed the index file in directory...
usr/share/nginx/test.com
I have edited the hosts configuration in
/etc/hosts
now when i do curl test.com i am getting 404 not found error as




test.comwith aserver_namedirective. Which is saying that it will respond only when you will pass the correct host header in your request. Just add-H "Host: test.com"to curl command to pass correct host header.curl -H "Host: test.com" --URL "http://test.com"