我正在尝试遵循 yapp 简介 并遇到一些基本困难。
准备工作:yaws 版本为 1.9,yapp 已安装(带文档)。 Yaws 和 Yapp 手动安装,Erlang 在 MacOS X 10.6 上使用 Homebrew 安装。
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:true]
配置正是如此我们在 yapp 简介中看到:
<server localhost>
port = 8000
listen = 0.0.0.0
docroot = /usr/local/var/yaws/www
arg_rewrite_mod = yapp
<opaque>
yapp_server_id = edo
</opaque>
</server>
<server localhost>
port = 8001
listen = 0.0.0.0
docroot = /usr/local/var/yaws/www
arg_rewrite_mod = yapp
<opaque>
yapp_server_id = ido
bootstrap_yapps = yapp
</opaque>
</server>
我还设置了以下内容(在服务器块之前):
ebin_dir = /usr/local/lib/yaws/examples/ebin
ebin_dir = /usr/local/var/yaws/ebin
ebin_dir = /usr/local/lib/yapp/ebin
...
runmod = yapp
Mnesia 也按照 yapp 简介中的说明进行设置,并且yaws 正在使用正确的节点名启动,生成以下输出:
Eshell V5.8.4 (abort with ^G)
(dclements@server)1>
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Yaws: Using config file /usr/local/etc/yaws/yaws.conf
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Ctlfile : /Users/dclements/.yaws/yaws/default/CTL
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Yaws: Listening to 0.0.0.0:8001 for <1> virtual servers:
- http://localhost:8001 under /usr/local/var/yaws/www
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Yaws: Listening to 0.0.0.0:8000 for <1> virtual servers:
- http://localhost:8000 under /usr/local/var/yaws/www
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Yapp starting but Yaws not ready - waiting 500 ms
=INFO REPORT==== 11-Jul-2011::13:10:59 ===
Starting yapp
(dclements@server)1>
查看哈欠创建者的 yapp 上的页面 我在“启动 yapp”之后看到一些额外的输出,看起来好像已经注册了。无论我等多久,这都不会显示。
此后,尝试访问网站不会产生所需的结果(http://localhost:8001/yapp/ 将我带到“未找到”页面)。但是,我确实看到了以下内容:
(dclements@server)1> yapp:get_yapps().
[]
(dclements@server)2> yapp:get_bootstrap_yapps().
[{"ido",[{"/yapp",yapp}]}]
将 listen
更改为 127.0.0.1
并未更改任何结果。更改服务器名称以使其不同同样不会产生任何效果。
我觉得我缺少一些基本但根本的东西,并且四处搜索并没有提供任何好的答案。任何帮助表示赞赏。
I am trying to follow the yapp intro and having some basic difficulties.
Preliminaries: Version of yaws is 1.9, yapp has been installed (with docs). Yaws and Yapp installed manually, Erlang installed using Homebrew on MacOS X 10.6.
Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:8:8] [rq:8] [async-threads:0] [hipe] [kernel-poll:true]
Configuration is exactly what we see on the yapp intro:
<server localhost>
port = 8000
listen = 0.0.0.0
docroot = /usr/local/var/yaws/www
arg_rewrite_mod = yapp
<opaque>
yapp_server_id = edo
</opaque>
</server>
<server localhost>
port = 8001
listen = 0.0.0.0
docroot = /usr/local/var/yaws/www
arg_rewrite_mod = yapp
<opaque>
yapp_server_id = ido
bootstrap_yapps = yapp
</opaque>
</server>
I also have the following as part of the setup (before the server blocks):
ebin_dir = /usr/local/lib/yaws/examples/ebin
ebin_dir = /usr/local/var/yaws/ebin
ebin_dir = /usr/local/lib/yapp/ebin
...
runmod = yapp
Mnesia set up as per the directions on the yapp intro as well and yaws is being launched with the correct nodename, generating the following output:
Eshell V5.8.4 (abort with ^G)
(dclements@server)1>
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Yaws: Using config file /usr/local/etc/yaws/yaws.conf
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Ctlfile : /Users/dclements/.yaws/yaws/default/CTL
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Yaws: Listening to 0.0.0.0:8001 for <1> virtual servers:
- http://localhost:8001 under /usr/local/var/yaws/www
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Yaws: Listening to 0.0.0.0:8000 for <1> virtual servers:
- http://localhost:8000 under /usr/local/var/yaws/www
=INFO REPORT==== 11-Jul-2011::13:10:58 ===
Yapp starting but Yaws not ready - waiting 500 ms
=INFO REPORT==== 11-Jul-2011::13:10:59 ===
Starting yapp
(dclements@server)1>
Seeing the yawn creator's page on yapp I see some additional output after the "Starting yapp" where it looks like things are registered. This does not show no matter how long I wait.
After this, attempting to visit the websites does not produce the desired result (http://localhost:8001/yapp/ brings me to a "not found" page). I do, however, see the following:
(dclements@server)1> yapp:get_yapps().
[]
(dclements@server)2> yapp:get_bootstrap_yapps().
[{"ido",[{"/yapp",yapp}]}]
Changing the listen
to 127.0.0.1
has not changed any of the results. Changing the server names so that they are different similarly does not have an effect.
I feel like there is something basic but fundamental that I am missing, and searching around has not provided any good answers. Any help is appreciated.
发布评论
评论(1)
尽管问题提出已经过去一年了,而且可能作者自己已经找到了解决方案,但我希望我的答案对像我这样遇到问题并首先通过谷歌搜索到此页面的 erlang 新手有用。
所以我发现问题不在于 yapp,而在于初始 Mnesia 设置配置。我只是尝试仔细地重复维基百科中描述的所有步骤,这使我获得了成功的结果。更准确地说,首先我在 yaws.conf 文件中指定了 mnesia 目录:
然后我重新启动了 Mnesia(mnesia:stop/0, mnesia:start/0) 并删除了 schema(mnesia:delete_schema/1)。最后,我重复了 http://yaws.hyber.org/yapp_intro.yaws 中的步骤。
Despite the fact that a year has passed since the question was asked, and probably the author have already found solution himself, I hope that my answer would be useful for erlang-newbies like me who faced the problem and first googled to this page.
So I have discovered that the problem is not with yapp, but with initial Mnesia setup configuration. I just simply tried to carefully repeat all steps that were described in the wiki and it resulted me to successful result. To be more precisely firstly I have specified mnesia dir in the yaws.conf file:
then I have restarted Mnesia(mnesia:stop/0, mnesia:start/0) and deleted the schema(mnesia:delete_schema/1). And finally I have repeated steps from http://yaws.hyber.org/yapp_intro.yaws.