我在我的 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_URL
至 http://gentlenode.com/
, 至 http://gentlenode/
或到 http://localhost/
?你可以在这里找到我的 nginx 配置:https://gist.github.com/LeCoupa/9877434
最佳答案
ROOT_URL
环境变量应设置为客户端将用于访问您的应用程序的 URL。所以在你的情况下,它将是 http://gentlenode.com
或 https://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/