流星-"ROOT_URL"的目的是什么?以及应该定义什么? [英] Meteor - What is the purpose of "ROOT_URL" and to what should it be defined?
问题描述
在使用Ubuntu服务器上的PhantomJS进行蜘蛛工作时,我遇到了一些问题.我在 Meteorpedia 上看到了此疑难解答:
I'm getting some problems to make spiderable work with PhantomJS on my Ubuntu server. I saw this troubleshooting on Meteorpedia:
确保您的Meteor服务器配置为使用ROOT_URL 可从服务器本身访问. (自v0.8.1.3 [1]起)
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])
我认为这可能是为什么它不起作用的可能答案.此环境变量的确切用途是什么?
I think that this could be a possible answer to why it is not working. What is exactly the purpose of this environment variable?
我的应用程序可以在http://gentlenode.com/
上公开访问,但是我在nginx上的proxy_pass
设置为http://gentlenode/
.
My application is publicly accessible on http://gentlenode.com/
but my proxy_pass
on nginx is set to 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/
吗?
Should I set ROOT_URL
to http://gentlenode.com/
, to http://gentlenode/
or to http://localhost/
?
您可以在这里找到我的nginx配置: https://gist.github.com/LeCoupa/9877434 >
You can find my nginx configuration here: https://gist.github.com/LeCoupa/9877434
推荐答案
ROOT_URL
环境变量应设置为客户端用来访问您的应用程序的URL.因此,根据您的情况,它应该是http://gentlenode.com
或https://gentlenode.com
.
The ROOT_URL
environment variable should be set to the URL that clients will be accessing your application with. So in your case, it would be http://gentlenode.com
or https://gentlenode.com
.
ROOT_URL
环境变量由 Meteor.absoluteUrl
读取,在许多(核心)中使用包.因此,如果使用这些软件包,可能需要设置ROOT_URL
. spiderable
是这样的一个软件包.
The ROOT_URL
environment variable is read by Meteor.absoluteUrl
, which is used in many (core) packages. Thus, setting ROOT_URL
may be a requirement if you use these packages. spiderable
is one such package.
// Line 62 of spiderable_server.js
var url = Spiderable._urlForPhantom(Meteor.absoluteUrl(), req.url);
这篇关于流星-"ROOT_URL"的目的是什么?以及应该定义什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!