【问题标题】:nginx proxy_pass http://127.0.0.1:3000 not workingnginx proxy_pass http://127.0.0.1:3000 不工作
【发布时间】:2019-01-29 01:56:21
【问题描述】:

我的配置有什么问题,当我打开 http://management.teampapercloud.in/ 时,我看到默认的 nginx 主页,它没有到达我在 PORT 3000 上运行的节点服务器。

server {
    server_name  management.teampapercloud.in www.management.teampapercloud.in;
    listen 80;

    root /usr/share/nginx/;
    # index index.html index.htm;

    location /static {
        alias /home/ubuntu/papercloud/static;
    }   

    location /media {
        alias /home/ubuntu/papercloud/paper_cloud/paper_cloud/media;
    }

    location = /favicon.ico { access_log off; log_not_found off; }

    location / {
        add_header Access-Control-Allow-Origin '*';
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Forwarded-For  $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_connect_timeout 50;
        proxy_read_timeout 50;

        # This line is important as it tells nginx to channel all requests to port 8000.
        # We will later run our wsgi application on this port using gunicorn.
        proxy_pass http://127.0.0.1:3000;

        client_max_body_size 20m;
    }

    location /.well-known/acme-challenge/ {
        try_files $uri $uri/ =404;
    }

}

【问题讨论】:

  • 你重启Nginx了吗?使用nginx -t 测试配置。你能在nginx -T 的输出中看到你的server 块吗?检查访问和错误日​​志,并在您的问题中包含任何相关条目。
  • 即使在停止 nginx 之后,它仍然可以工作。无法弄清楚发生了什么

标签: nginx nginx-location nginx-reverse-proxy nginx-config


【解决方案1】:

确定

  • 您的域指向正确的服务器 IP 地址。
  • 修改后你已经重启了nginx服务。
  • 查找服务器名称拼写错误。
  • nginx.conf 包含 /usr/local/etc/nginx/sites-enabled/*;
  • 默认配置 nginx 不会覆盖您的任何服务器块。

【讨论】:

  • 检查了所有这些,没有任何问题,有什么提示吗?
猜你喜欢
  • 1970-01-01
  • 2017-10-29
  • 2018-02-19
  • 1970-01-01
  • 2021-07-18
  • 2018-10-25
  • 1970-01-01
  • 2015-03-23
  • 2018-02-24
相关资源
最近更新 更多