yaws,erlyweb学习笔记

安装配置:yaws直接下载安装,erlyweb下载直接解压到erlang的lib下。
Yaws官网http://yaws.hyber.org/index.yaws
Erlyweb官网http://erlyweb.org/,,,,,入门教程
http://yarivsblog.com/articles/2006/10/27/introducing-erlyweb-the-erlang-twist-on-web-framworks/

 

yaws -i  启动yaws服务器

Yawsrestart()。重启yaws服务器,(每次修改内容都要重启?)

<!--EndFragment-->

 

 

安装遇到很多问题,不一一描述,注意路径 ,特别是ebin路径。

 

%%关于配置文件yaws.conf:
logdir = "C:\Yaws-1.88/logs"
%%特别注意资源文件目录
ebin_dir = "C:\Yaws-1.88/examples/ebin"
ebin_dir = "E:\test/YAWS/music/ebin"

%%一般是包含文件目录
include_dir = "C:\Yaws-1.88/examples/include"

# This is a debug variable, possible values are http | traffic | false
# It is also possible to set the trace (possibly to the tty) while
# invoking yaws from the shell as in
# yaws -i -T -x (see man yaws)
trace = false
<server localhost>
        port = 8080
        listen = 0.0.0.0
        docroot = "C:\Yaws-1.88/www"
%%cgi-bin访问路径中的标识,只要在localhost:8080/后面出现即可,不一定紧挨着8080/。
%%yaws_appmod_cgi是要跳转到的模块的名字(和路径无关,只是module名字)。
        appmods = <cgi-bin, yaws_appmod_cgi>        
</server>

<server localhost>
 		port=8088
 		listen=0.0.0.0
 	docroot = E:\test/YAWS/music/www
appmods = <"/music",erlyweb>
<opaque>
  appname = music
</opaque>

</server>

<server localhost>
        port = 8087
        listen = 0.0.0.0
        docroot = "E:\test/YAWS"
        appmods = <test,myappmod>  
        <opaque>
  appname = music
  1=a
  2=b
</opaque>
</server>
 

 

<!--EndFragment--> <Opaque></opaque>内可以随便定义键值对,可以用A#arg.opaque去得其中的值,上面所取得值是A#arg.opaque=[{2,b},{1,a},{appname,music}].(不知道为什么是从下往上来的)。

 

 

 

ERROR erlang code crashed:
File: appmod:0
Reason: {no_application_data,Did you forget to call erlyweb:compile(AppDir) or add the apps previously compiled .beam files to the Erlang code path?}
Req: {http_request,GET,{abs_path,/music},{1,1}}

出现这个问题是因为ebin_dir路径不正确,要设置到myappebin

<!--EndFragment-->

你可能感兴趣的:(C++,c,erlang,C#,cgi)