Nginx assuming all non-specified domains are handled by another vhost

Hi all,

I’m not quite sure how to explain my problem, hence a failure to
google effectively, so I don’t know if this problem is unique or not,
or whether it’s me or a bug.

I have many domains, and therefore have many vhosts. One of them is
abscond.org, my personal site. However, any domains that don’t have a
vhost get sent to the abscond.org vhost. And if I create a default
vhost, I get the following error on start, despite only mentioning
the term abscond.org once.

nginx2007/10/19 20:57:29 [warn] 16880#0: conflicting server name
abscond.org” on 0.0.0.0:8080, ignored

I think it’s best to show you my test config files with just two
domains and output directly, so I’ve outlined my issue in a pastie -
please see Parked at Loopia

Thanks for any help,
James Darling

On Sat, October 20, 2007 02:05, James Darling wrote:

I think it’s best to show you my test config files with just two
domains and output directly, so I’ve outlined my issue in a pastie -
please see Parked at Loopia

You have to add this to your default vhost:

server_name _ *;
listen 8080 default;

You’re basically saying that you want to accept any server name and that
this server{} instance is the default one…

I got tricked by this at first, exactly like you :slight_smile:

On Sat, Oct 20, 2007 at 01:05:32AM +0100, James Darling wrote:

nginx2007/10/19 20:57:29 [warn] 16880#0: conflicting server name
abscond.org” on 0.0.0.0:8080, ignored

I think it’s best to show you my test config files with just two
domains and output directly, so I’ve outlined my issue in a pastie -
please see Parked at Loopia

If you did not define “server_name” in “server {}”, then nginx use
hostname as server_name. It’s seems that your hostname is abscond.org.

You may set

server_name  _ *;

as it was already suggested.
“_” is simple nonexistent domain name.

On 20 Oct 2007, at 09:15, Brice F. wrote:

server_name _ *;
listen 8080 default;

Thanks a tonne both of you. That solved it.

I hope you don’t mind, I have added it to the vhost example wiki
page, as it seems I was not the only one with this problem, and it
seemed like a sensible place to have it.

Thanks again,
James