Server_name _; doesn't work

Hello, when I set a default vhosts with server_name _; it doesn’t work.
Here the example file:
server {
listen 80;
server_name _ ; # underdash means for all hosts

    location / {
            root /var/www/html;
            index index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
            root   /var/www/html;
    }

}

Posted at Nginx Forum:

See this:
http://wiki.nginx.org/NginxHttpCoreModule#server_name
And state your version and OS. Also the full config might help…


() ascii-rubanda kampajno - kontraŭ html-a retpoŝto
/\ ascii ribbon campaign - against html e-mail

Hello!

On Mon, Mar 08, 2010 at 03:36:46PM -0500, kleinchris wrote:

Hello, when I set a default vhosts with server_name _; it doesn’t work. Here the example file:
server {
listen 80;
server_name _ ; # underdash means for all hosts

It doesn’t “means for all hosts”. It’s just some non-existant
name.

See here:

http://nginx.org/en/docs/http/request_processing.html

Maxim D.

Ah just used, know it works but on my other server I get a rewrite for
marie3.briefdomain.de to
http://www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.www.marie3.briefdomain.de/
o,o

thanks the default helped me…

Posted at Nginx Forum:

And I want a domain to rewrite to www.domain.tld

So that domain.tld and *.domain.tld would be redirected to
www.domain.tld

Posted at Nginx Forum:

On Mon, Mar 08, 2010 at 07:50:52PM -0500, kleinchris wrote:

And I want a domain to rewrite to www.domain.tld

So that domain.tld and *.domain.tld would be redirected to www.domain.tld

http://nginx.org/en/docs/http/converting_rewrite_rules.html


Igor S.
http://sysoev.ru/en/

Maxim is right.

Instead, use ‘listen 80 default;’ for that virtual host server block.

Ray.