我在Ubuntu服务器上使用PhantomJS进行蜘蛛侠工作时遇到了一些问题.我在Meteorpedia上看到了这个故障排除:
确保可以从服务器本身访问Meteor服务器配置使用的ROOT_URL.(自v0.8.1.3 [1])
我认为这可能是一个可能的答案,为什么它不起作用.这个环境变量的目的是什么?
我的应用程序可公开访问,http://gentlenode.com/
但我的proxy_pass
on 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);