Main head
This concept comes from the Windows IIS server; We can simply understand that a host header is a hostname;
Nginx Disable empty host header configuration
Can distribute requests according to domain name and location, reverse proxy;
Such as
server { 80; server_name _; ##标示空主机头 location / { root html; return404; } location ~ /.ht { all; } }
This disables the empty host header access;
Nginx Set the domain name that can be forwarded
Ss
server {Listen the;server_name www. Test. com;Location/{root HTML;Index Index. htmlIndex. htm;}} server {listen the;server_name localhost;#charset koi8-r;#access_log Logs/host.access.log main;Location/{root HTML;Index Index. htmlIndex. htm;}#error_page 404/404.html;# REDIRECT Server error pages to the static page/50x.html#Error_page -502503504/ -x. html;Location =/ -x. html{Root HTML;} Location ~ (favicon. ico) {Root HTML;} }
In the native configuration of two virtual host, one is www.test.com, one is localhost;
And the host binding is (modifies the/etc/hosts file):
127.0.0.1 localhost127.0.0.1 www.test.com127.0.0.1 www.test1.com
can now be accessed through localhost and www.test.com, while access via www.test1.com is rejected, reported 404 error;
'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
'). Text (i)); }; $numbering. FadeIn (1700); }); });
The above describes the Nginx empty host header, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.