【问题标题】:Nginx and upstream : configuration failedNginx 和上游:配置失败
【发布时间】:2015-03-22 14:42:28
【问题描述】:

我尝试使用 nginx 测试负载均衡器,因此我像文档示例一样添加上游。但是当我尝试重新加载nginx刷新配置时,刷新失败。
我刚刚添加了上游集团,如果我删除它所有工作

文件:/etc/nginx/sites-available/default

upstream backend {
    server webserver1:80;
    server webserver2:80;
}

server {
    listen 80;
    listen [::]:80;

    server_name www.interceptlocalcall.io interceptlocalcall.io;

    location /users {
            proxy_pass http://127.0.0.10:18000;
    }
...

当我重新加载上游块时:

[FAIL] Reloading nginx configuration: nginx failed!

Nginx 版本:

nginx version: nginx/1.6.2

我看到了有关此错误的任何信息,所以我想我只是错过了一些东西,也许是在安装中?
如果您有任何想法,谢谢。

【问题讨论】:

    标签: nginx load-balancing


    【解决方案1】:

    请通过运行$ nginx -c /etc/nginx/nginx.conf -t 测试您的配置——它会告诉您有关您的配置有什么问题的更多详细信息。 这些消息也写入全局 error.log 文件(不是您为服务器定义的,而是在http 部分定义的),通常位于/var/log/nginx/error.log

    【讨论】:

    • 谢谢,我在您的帮助下检查了我的日志,终于可以正常工作了!我写错了我的主机名,所以...host not found.
    猜你喜欢
    • 2014-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-14
    • 2023-03-07
    • 2021-08-10
    • 1970-01-01
    • 2017-03-16
    相关资源
    最近更新 更多