简体   繁体   中英

Can I stick with server_name directive from nginx or do I still need to set DNS in linux?

I am learning nginx and I have this doubt. Do I need to setup a dns in linux (/etc/resolv.conf) or can I just stay with what nginx uses inside its directive server_name?

You can set nginx to listen to ANY domain pointed to that web server with:

listen       80  default_server;

or you can be specific via server_name . Check Nginx docs

Setting DNS on the webserver itself does not help much..

Adding the entry in your visitor's PC hosts file can override a domain name's A record pointer to the one specified by you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM