Problems with nginx multiple domain name resolution
迷茫
迷茫 2017-05-16 17:10:22
0
4
594

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?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(4)
过去多啦不再A梦

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;
}
滿天的星座

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;
}
淡淡烟草味

server {

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

}

黄舟

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

listen 80;
server_name baidu.com qq.com;

}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template