Some questions about nginx's serverName

when we want to use nginx to manage static resources, start nginx on the 10.xx.xxx.xx machine (the code part is part of the nginx configuration) where server_name can only be the address of the machine 10.xx.xxx.xx if the 10.xx.xxx.xx machine does not have a domain name? If there is a domain name www.abc.com that will be resolved to this machine, server_name can only be www.abc.com

.
listen       80;
server_name  10.xx.xxx.xx;    
root  /data0/abc;   


listen       80;
server_name  www.abc.com10.xx.xxx.xxwww.abc.com;    
root  /data0/abc;   

server_name is not allowed to be written here? Do I understand this? Boss, give me an explanation. Thank you

.
Aug.18,2021

when nginx does not find serverName, it matches the same listen port that was first configured. You can also do this:

  https://codeshelper.com/a/11.

Menu