【问题标题】:How to set Foxx App at server root?如何在服务器根目录设置 Foxx App?
【发布时间】:2014-05-12 07:40:28
【问题描述】:

我想知道如何在服务器/ip/域名的根目录下设置 Foxx 应用程序?

例如,如果我的 IP 是 100.12.32.12,如果我转到 http://100.12.32.12,它将打开单页 foxx 应用程序而无需 URL 重定向。

我尝试过的事情

  1. 目前我让 Arangodb 使用 tcp://0.0.0.0:80 端点,所以我让端口工作。

  2. 我还在我的应用程序的manifest.json 中设置了一个index.html 文件并将该应用程序安装到/

    但是,目前转到 http://100.12.32.12 会将我重定向到 http://107.170.131.61/_db/_system/index.html,这可行,但 URL 已更改。

    http://100.12.32.12/index.html 也可以工作,但我想知道是否可以让http://100.12.32.12 在没有重定向的情况下显示应用程序。

  3. 我已经尝试过sudo arangod --javascript.app-path /path/to/app,但这似乎不起作用。

谢谢。我是 Arangodb 和 Foxx 的新手。

【问题讨论】:

  • 您是将 ArangoDB 直接暴露给 NET 还是在 Apache 之类的网络服务器后面使用它?
  • 将它暴露在 80 端口上......我希望只需要使用 Foxx/Arangodb 作为我的水疗中心
  • 好的,明白了。我会问我的同事。
  • @fceller 谢谢 :) 如果这不是预期用途,我可以在默认端口 8529 上保留 arango,并在端口 80 上启动快速服务器...

标签: arangodb foxx


【解决方案1】:

您可以尝试以下方法吗?在终端窗口中打开 arangosh 或在 GUI 中转到 JS shell。

arangosh [_system]> db._routing.save({ url: "/", priority: 1, action: {do: "org/arangodb/actions/redirectRequest", options: {permanently: true, destination: "/index.html" } } })
{ 
  "error" : false, 
  "_id" : "_routing/87048615", 
  "_rev" : "87048615", 
  "_key" : "87048615" 
}

重启服务器(它需要重新加载现在的路由)。清除/重新启动浏览器(对于 chrome,您可能需要忘记访问过的站点)。使用 telnet 进行检查

> telnet localhost 8529
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1

HTTP/1.1 301 Moved
location: http://localhost:8529/index.html
server: ArangoDB
content-type: text/html
connection: Keep-Alive
content-length: 183

<html><head><title>Moved</title></head><body><h1>Moved</h1><p>This page has moved to <a href="http://localhost:8529/index.html">http://localhost:8529/index.html</a>.</p></body></html>

如果您没有看到正确的地址,请检查文档是否在 _routing 中正确创建。

现在用浏览器检查。如果这仍然显示错误的重定向,请刷新浏览器缓存。

【讨论】:

  • 谢谢,重定向有效,但 URL 仍然更改为 index.html 是否有没有 URL 更改?
  • 使用 ArangoDB 2.1 RC2,您将能够执行 db._routing.save({ url: "/", priority: 1, action: {do: "org/arangodb/actions/rewriteRequest", options: {destination: "/index.html" } } }) 使用 GITHUB 或 arangodb.org/download2
  • 谢谢!我会满怀期待的。
猜你喜欢
  • 2020-02-14
  • 2015-08-22
  • 1970-01-01
  • 2014-05-10
  • 1970-01-01
  • 2011-08-14
  • 2013-07-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多