Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the `_` meaning in nginx configuration?

Tags:

nginx

what's the _ meaning in nginx?

in a nginx.conf I see this config:

listen       8080;
server_name  _;

what's the _ meaning?

like image 924
user7693832 Avatar asked Oct 18 '25 14:10

user7693832


1 Answers

From the documentation:

There is nothing special about this name, it is just one of a myriad of invalid domain names which never intersect with any real name. Other invalid names like “--” and “!@#” may equally be used.

With current versions of Nginx, it is perfectly valid to remove the server_name directive from the server block, rather than specify it with a fake name.

like image 116
Richard Smith Avatar answered Oct 21 '25 11:10

Richard Smith



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!