【发布时间】:2016-01-21 10:33:51
【问题描述】:
我在 Windows Azure VM 上成功启动了 Yaws 服务器,但我无法访问公共域。
目前,我只想使用 Yaws 来托管我的静态内容。
我搜索了一些文章,但没有找到解决方案。
这里是详细的,请给我一些想法,谢谢。
我在 localhost:8000 上启动了 Yaws 服务器
我已经通过以下conf启动了Yaws服务器:
# /etc/yaws/conf.d/localhost.conf
<server localhost>
port = 8000
listen = 127.0.0.1
docroot = /home/me/website
# dir_listings = true
</server>
我认为我成功启动了http服务器,因为我可以通过curlindex.html的内容:
curl losthost:8000
我在 Windows Azure VM 中绑定端点
我还在 Window Azure VM (Ubuntu Server 15.04) 上设置了端点:
NAME | PROTOCOL | PUBLIC PORT | PRIVATE PORT
:----|:---------|:------------|:-------------
HTTP | TCP | 80 | 8000
但无法访问azeure_vm_name.cloudapp.net
但我无法通过azure_vm_name.cloudapp.net 访问静态网站。
cloudapp.net 是 Windows Azure VM 的公共域。
但是我可以启动python服务器访问公共域
之前,我尝试在文件夹 /home/me/website 中启动 python http.server:
# python 3
python -m http.server
# python 2
python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
来自 Yaws 服务器的信息报告
$ sudo yaws -i
Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-
poll:true]
Eshell V6.2 (abort with ^G)
1>
=INFO REPORT==== 22-Oct-2015::07:30:46 ===
Yaws: Using config file /etc/yaws/yaws.conf
=INFO REPORT==== 22-Oct-2015::07:30:46 ===
Yaws: Using subconfig file /etc/yaws/conf.d/localhost.conf
=INFO REPORT==== 22-Oct-2015::07:30:48 ===
yaws debug:Add path "/usr/lib/yaws/custom/ebin"
=INFO REPORT==== 22-Oct-2015::07:30:48 ===
yaws debug:Add path "/usr/lib/yaws/examples/ebin"
=INFO REPORT==== 22-Oct-2015::07:30:48 ===
yaws debug:Running with id="default" (localinstall=false)
Running with debug checks turned on (slower server)
Logging to directory "/var/log/yaws"
=INFO REPORT==== 22-Oct-2015::07:30:48 ===
Ctlfile : /home/me/.yaws/yaws/default/CTL
=INFO REPORT==== 22-Oct-2015::07:30:48 ===
Yaws: Listening to 127.0.0.1:8000 for <1> virtual servers:
- http://localhost:8000 under /home/me/website
参考文献
Installing Yaws server on Ubuntu 12.04 (Using a cloud service)
【问题讨论】:
-
我怀疑 Yaws 正在丢弃您的请求,因为您请求中的服务器名称与其配置的任何服务器都不匹配。检查
/var/log/yaws下的日志以查看它们是否显示任何错误。您也可以考虑运行sudo yaws -i --debug,这可能会为您提供更多信息。
标签: azure erlang httpserver yaws