Forum: NGINX server_name _; doesn't work

Posted by kleinchris (Guest)
on 2010-03-08 21:37
(Received via mailing list)
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: 
http://forum.nginx.org/read.php?2,61579,61579#msg-61579
Posted by Nuno Magalhães (Guest)
on 2010-03-08 22:28
(Received via mailing list)
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
Posted by Maxim Dounin (Guest)
on 2010-03-08 22:54
(Received via mailing list)
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 Dounin
Posted by Ray (Guest)
on 2010-03-09 01:34
(Received via mailing list)
Maxim is right.

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

Ray.
Posted by kleinchris (Guest)
on 2010-03-09 01:48
(Received via mailing list)
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: 
http://forum.nginx.org/read.php?2,61579,61676#msg-61676
Posted by kleinchris (Guest)
on 2010-03-09 01:51
(Received via mailing list)
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: 
http://forum.nginx.org/read.php?2,61579,61677#msg-61677
Posted by Igor Sysoev (Guest)
on 2010-03-09 08:40
(Received via mailing list)
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 Sysoev
http://sysoev.ru/en/
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.