nginx 错误“服务器名称冲突"忽略

nginx 错误“服务器名称冲突

问题描述:

server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    #root /usr/share/nginx/www;

root /home/ubuntu/node-login;
    # Make site accessible from 
    server_name ec2-xx-xx-xxx-xxx.us-west-1.compute.amazonaws.com;

location /{
    proxy_pass http://127.0.0.1:8000/;
    proxy_redirect off;
}

}

这会导致 nignx 错误 [警告] 0.0.0.0:80 上的冲突服务器名称ec2..."被忽略我不明白,任何解释表示赞赏.谢谢.

this results in nignx error [warn] conflicting server name "ec2..." on 0.0.0.0:80 ignored I dont understand, any explanation appreciated. Thanks.

我假设您运行的是 Linux,并且您正在使用 gEdit 来编辑您的文件.在 /etc/nginx/sites-enabled 中,它可能留下了一个临时文件,例如default~(观看~).

I assume that you're running a Linux, and you're using gEdit to edit your files. In the /etc/nginx/sites-enabled, it may have left a temp file e.g. default~ (watch the ~).

根据您的编辑器,文件可以命名为 .save 或类似名称.只需运行 $ ls -lah 以查看无意中存在哪些文件并删除它们(感谢 @Tisch 为此).

Depending on your editor, the file could be named .save or something like it. Just run $ ls -lah to see which files are unintended to be there and remove them (Thanks @Tisch for this).

删除这个文件,它会解决你的问题.

Delete this file, and it will solve your problem.