conflicting server name ignored

Events happening in the community are now at Drupal community events on www.drupal.org.
Anonymous's picture
Posted by Anonymous on April 8, 2013 at 6:06am

While restarting Nginx I get the warning mentioned below. I don't have other servers running just one domain with ssl, and I have defined server name after every server block. I'm using 99% Perusio's config, 1% mine server name and some values.

Does this warning means, if I am using single domain, I don't have to define the server name or port again and again after every server block ?

Performing sanity check on nginx configuration:
nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.example.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "example.com" on 0.0.0.0:443, ignored
nginx: [warn] conflicting server name "www.example.com" on 0.0.0.0:443, ignored
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Stopping nginx.
Waiting for PIDS: 19102.
Performing sanity check on nginx configuration:
nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.example.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "example.com" on 0.0.0.0:443, ignored
nginx: [warn] conflicting server name "www.example.com" on 0.0.0.0:443, ignored
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.
nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.example.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "example.com" on 0.0.0.0:443, ignored
nginx: [warn] conflicting server name "www.example.com" on 0.0.0.0:443, ignored
Categories:

Comments

sorry for the double post,

Posted by rajibmp (not verified) on April 8, 2013 at 6:13am
rajibmp's picture

sorry for the double post, actually its not my fault, Drupal page took way much time when I submitted the post, and it just died due to execution time limit over. I hit refresh, and was prompted to the question again, hence double post. It looks like I don't have rights t delete the posts, so, the moderator please feel free to delete one among these two posts.

When you get the "server"

Posted by bhosmer on April 8, 2013 at 10:55am

When you get the "server" error, it most likely means you have two or more server blocks with the same name somewhere. It doesn't mean actual servers in this contents.

Check your entries for

server {
server_name www.example.com;

....

yes I have multiple server_name

Posted by rajibmp (not verified) on April 8, 2013 at 6:40pm
rajibmp's picture

in server {} block. I am using Perusio's config and according to his config he has four server{} where 2 server blocks are for HTTP and remaining for HTTPS. If I comment out server_name from other server blocks I don't get that warning, but again, I think it is good to have server_name in HTTPS. My blocks are somewhat like:

## Return (no rewrite) server block.
server {
listen 80;
server_name example.com www.example.com;
return 301 $scheme://example.com$request_uri;
}

#HTTP Server
server {
listen 80;
server_name example.com www.example.com
# The other codes here
}

## Return (no rewrite) server block.
server {
listen 443;
server_name example.com www.example.com;
return 301 $scheme://example.com$request_uri;
}

#HTTPS Server
server {
listen 443;
server_name example.com www.example.com
## The other codes here
}

Now, if I keep the first one and comment out other ones, I don't get the warning.

I think your first block is

Posted by bhosmer on April 8, 2013 at 1:43pm

I think your first block is giving you the problem because of the rewrite:

## Return (no rewrite) server block.
server {
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}

#HTTP Server
server {
listen 80;
server_name example.com;
# The other codes here
}

Well

Posted by perusio on April 8, 2013 at 2:08pm

first you can combine the SSL and non SSL hosts in a single server block.

server {
listen 80;
listen 443 ssl;
server_name www.example.com

# SSL Cert and key here.

return 301 $scheme://example.com$request_uri;
}

Are you using other socket options besides ssl?

I never knew you could

Posted by bhosmer on April 8, 2013 at 5:43pm

I never knew you could include them in the same server block. Thanks @perusio!

I don't have any other sockets in use,

Posted by rajibmp (not verified) on April 8, 2013 at 6:38pm
rajibmp's picture

just FPM in unix socket. I have included both 80 and 443 in same block, as you suggested and I am using only one domain, ssl is working properly.

@bhosmer: you are right, when commented the server block which contains rewrite, I don't get the warning anymore. I really don't know if that's rewrite issue, but if I use second block and comment out others it still works.

@perusio: I am having a wild guess, as I have both example.com and www.example.com as server_name does that affect the "No Rewrite Server Block" ? as in that block the return 301 is overwritten by $scheme://example.com$request_uri, Do I also have to add $scheme://www.example.com$request_uri ?

This: server { listen

Posted by bhosmer on April 8, 2013 at 7:30pm

This:

server {
listen 80;
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}

#HTTP Server
server {
listen 80;
server_name example.com;
# The other codes here
}

Basically means this:

If a request for www.example.com comes in, return the code 301, which means permanently moved, and redirect the request to example.com instead.

Aye,

Posted by rajibmp (not verified) on April 9, 2013 at 6:36am
rajibmp's picture

I got the point now.. thanks a lot...

Do you have other vhosts on this http instance?

Posted by perusio on April 9, 2013 at 4:27pm

BTW I was talking about listening socket options, like ipv6only, the receive, send buffers and backlog size.

No,

Posted by rajibmp (not verified) on April 9, 2013 at 10:12pm
rajibmp's picture

The IPv6 is commented and not in use. I don't have other vhosts and no other domains too. I don't even have client body/header buffer.

Have you tried

Posted by perusio on April 10, 2013 at 8:41am

restarting the server?

yes,

Posted by rajibmp (not verified) on April 15, 2013 at 9:47pm
rajibmp's picture

I restart the server. Sorry for long reply time. The problem was definitely with incuding more than two parameters in server_name. I had server_name example.com www.example.com which made it generate that warning, when I have either one of them, the warning is not generated.

I am still thinking how to pursue the subdomain situation here, as I just redirected www.example.com subdomain to example.com, now suppose I have language translation in subdomains like es.example.com pt.example.com for espanyol and portuguesa respectively then I might need separate server block and all those configs for each subdomains.

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /