json - Nodejs api 的 nginx 配置不返回/api 调用

标签 json node.js rest nginx command-line-interface

配置 NGINX 从 Nodejs 提供 JSON 时遇到问题。静态文件服务正常,但/API 请求超时。

NGINX 配置文件

server {
    listen 80;  
    root /home/doctorep/doctoreports;
    #index index.html index.htm;

    server_name doctoreports.com;

    location / {
    proxy_pass      http://127.0.0.1:8080;
    }

    location /api/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass http://127.0.0.1:8080;
    proxy_redirect off;
    }
}

我尝试了使用 google-foo 可以找到的所有配置变体,但都无法正常工作。如果我从 CLI 获取 api,我会得到预期的 json 返回。所以我认为问题出在 NGINX 配置上。如有任何帮助或建议,我们将不胜感激!

最佳答案

很抱歉回答我自己的问题...发现 CouchDB 存在依赖冲突并且无法正确提供 View 。通过设置 SSH 隧道并使用/_utils 尝试修改和查看我的数据库的/views 来解决这个问题。

关于json - Nodejs api 的 nginx 配置不返回/api 调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38559996/

相关文章:

Java Jersey JSON Web服务正确的数组返回

Javascript 自定义索引访问器

javascript - 使用 Ajax 调用返回 JSON 文件的 Highcharts

node.js - 使用单个服务器将 GraphQL 订阅添加到现有的 Express 应用程序

node.js - 我想通过 SendGrid 将邮件发送到我从 sequelize 查询中获得的特定 id,但邮件无法发送到从表中获取的邮件

node.js - 许多请求作为 TIME_WAIT - 这会导致 node.js 服务器出现并发问题吗?

java - Akka HTTP Java 客户端示例 POST JSON 消息

android - 使用 json 获取查询 - Retrofit 2.0

java - 在没有 Entity Framework 的情况下构建 OData API

java - JAX-WS header 身份验证