Home  >  Q&A  >  body text

Problems with nginx multiple domain name resolution

The current configuration file used by nginx is /etc/nginx/conf.d/default.conf

Now I want to add a new domain name binding, so I added

to the last line of default.conf

include theDomain.conf;

In theDomain.conf, the bound port is 80, server_name www.thedomain.com;

Reload configuration nginx -s reload

Error report:

nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored

nginx: [warn] conflicting server name "www.thedomain.com" on 0.0.0.0:80, ignored

I have no experience using nginx. Please give me some advice on how to deal with this situation. Thank you! ~


I just tried it and the domain name resolution was successful. nginx: [warn] This warning can be ignored, right?

迷茫迷茫2714 days ago567

reply all(4)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 17:12:22

    The error message means that two words were writtenserver_name。在一个环境内出现了两次不一样的server_name

    server_name 应该写在某个server 里面,只能有一个,写在 server What’s outside is the overall picture.

    server {
        port 80;
        sever_name thedomain.com;
    }

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-16 17:12:22

    The configuration file for Nginx multiple domain name resolution should be like this:

    server
    {
        listen 80;
        server_name baidu.com;
    }
    
    server
    {
        listen 80;
        server_name qq.com;
    }

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-16 17:12:22

    server {

    listen 80;
    server_name example.com www.example.com;

    }

    reply
    0
  • 黄舟

    黄舟2017-05-16 17:12:22

    There are two ways, one is multiple sever mentioned above, today I tried another
    server
    {

    listen 80;
    server_name baidu.com qq.com;

    }

    reply
    0
  • Cancelreply