nginx - Meteor - "ROOT_URL"的目的是什么,应该定义什么?

标签 nginx meteor

我在我的 Ubuntu 服务器上使用 PhantomJS 进行爬虫工作时遇到了一些问题。我在 Meteorpedia 上看到了这个故障排除:

Ensure that the ROOT_URL that your Meteor server is configured to use is accessible from the server itself. (Since v0.8.1.3[1])



我认为这可能是为什么它不起作用的可能答案。这个环境变量的目的究竟是什么?

我的应用程序可在 http://gentlenode.com/ 上公开访问但我的 proxy_pass在 nginx 上设置为 http://gentlenode/ .
# HTTPS Server
server {
    listen 443;
    server_name gentlenode.com;
    # ...

    location / {
        proxy_pass http://gentlenode/;
        proxy_http_version 1.1;
        # ...
    }
}

我应该设置ROOT_URLhttp://gentlenode.com/ , 至 http://gentlenode/或到 http://localhost/ ?

你可以在这里找到我的 nginx 配置:https://gist.github.com/LeCoupa/9877434

最佳答案

ROOT_URL环境变量应设置为客户端将用于访问您的应用程序的 URL。所以在你的情况下,它将是 http://gentlenode.comhttps://gentlenode.com .
ROOT_URL环境变量由 Meteor.absoluteUrl 读取,在许多(核心)包中使用。因此,设置 ROOT_URL如果您使用这些软件包,可能需要。 spiderable 就是这样的一个包。

// Line 62 of spiderable_server.js
var url = Spiderable._urlForPhantom(Meteor.absoluteUrl(), req.url);

关于nginx - Meteor - "ROOT_URL"的目的是什么,应该定义什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24046186/

相关文章:

Javascript:同步可观察事件

meteor - 如何防止通过控制台修改集合以进行其他安全的更新操作?

Nginx Ingress 仅在到另一台服务器的路径上重定向

error-handling - 在Nginx中,它必须是自动索引或目录禁止错误?

javascript - 如何在knownEvents处理函数中获取数据上下文

带有 Google OAuth 2.0 的 Nginx 代理

javascript - Meteor 1.3集合引用错误

HTTP 444(无响应)而不是 404、403 错误页面?

php - 使用 nginx 进行奇怪的 php 重定向(在 apache 中工作正常)

http - Nginx 服务器 : SSL_ERROR_RX_RECORD_TOO_LONG