我试图让一个Yaws Web服务器在云服务(Amazon AWS)上工作。 我已经在服务器上编译并安装了本地副本。 我的问题是我无法让Yaws在8000或80端口上运行。
我在yaws.conf中有以下configuration:
port = 8000 listen = 0.0.0.0 docroot = /home/ubuntu/yaws/www/test dir_listings = true
这会产生以下成功的启动/结果:
Eshell V5.8.5 (abort with ^G) =INFO REPORT==== 16-Sep-2012::17:21:06 === Yaws: Using config file /home/ubuntu/yaws.conf =INFO REPORT==== 16-Sep-2012::17:21:06 === Ctlfile : /home/ubuntu/.yaws/yaws/default/CTL =INFO REPORT==== 16-Sep-2012::17:21:06 === Yaws: Listening to 0.0.0.0:8000 for <3> virtual servers: - http://domU-12-31-39-0B-1A-F6:8000 under /home/ubuntu/yaws/www/trial - =INFO REPORT==== 16-Sep-2012::17:21:06 === Yaws: Listening to 0.0.0.0:4443 for <1> virtual servers: -
当我尝试访问url( http://ec2-72-44-47-235.compute-1.amazonaws.com )时,它永远不会连接。 我已经尝试使用paping来检查端口80或8000是否打开( http://code.google.com/p/paping/ ),我得到一个“主机无法解决”的错误,所以显然有些东西不是加工。
我也尝试设置yaws.conf,使其在80端口,如下所示:
port = 8000 listen = 0.0.0.0 docroot = /home/ubuntu/yaws/www/test dir_listings = true
我得到以下错误:
=ERROR REPORT==== 16-Sep-2012::17:24:47 === Yaws: Failed to listen 0.0.0.0:80 : {error,eacces} =ERROR REPORT==== 16-Sep-2012::17:24:47 === Can't listen to socket: {error,eacces} =ERROR REPORT==== 16-Sep-2012::17:24:47 === Top proc died, terminate gserv =ERROR REPORT==== 16-Sep-2012::17:24:47 === Top proc died, terminate gserv =INFO REPORT==== 16-Sep-2012::17:24:47 === application: yaws exited: {shutdown,{yaws_app,start,[normal,[]]}} type: permanent {"Kernel pid terminated",application_controller," {application_start_failure,yaws,>>>>>>{shutdown,>{yaws_app,start,[normal,[]]}}}"}
我也用iptables打开了80端口。 运行sudo iptables -L给出这个输出:
Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- ip-192-168-2-0.ec2.internal ip-192-168-2-16.ec2.internal tcp dpt:http ACCEPT tcp -- 0.0.0.0 anywhere tcp dpt:http ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT tcp -- anywhere anywhere tcp dpt:http Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
另外,我已经转到Amazon AWSconfiguration区域中的安全组面板,并将端口80,8000和8080添加到ip source 0.0.0.0
请注意:如果您现在尝试访问虚拟服务器的URL,它可能不会连接,因为我没有运行当前正在运行的yaws守护进程。 我已经通过雅司或亚利桑那州运行雅司的方式进行了testing
感谢耐心
如果您将服务放在端口8000上,那么您需要在您的URL中使用端口8000。 例如:
http://ec2-72-44-47-235.compute-1.amazonaws.com:8000/
此外,请检查您的弹性IP,并确保它仍然与实例相关联。