我试图让雅司病web服务器工作在云服务(Amazon AWS)。我compilled和安装在服务器上的本地副本。我的问题是,我不能让雅司病到端口8000或端口80上运行,同时运行。
我在yaws.conf以下配置:
端口= 8000
听= 0.0.0.0
文档根目录= /家庭/ Ubuntu的/雅司病/ WWW /测试
dir_listings =真
这将产生以下成功发射/结果:
ESHELL V5.8.5(中止与^ G)
=信息报告==== 16月 - 2012 :: 17:21:06 === 雅司病:使用配置文件/home/ubuntu/yaws.conf
=信息报告==== 16月 - 2012 :: 17:21:06 === Ctlfile:/home/ubuntu/.yaws/yaws/default/CTL
=信息报告==== 16月 - 2012 :: 17:21:06 === 雅司病:听0.0.0.0:8000为3;>虚拟服务器: - HTTP:// domU的-12-31-39-0B-1A-F6:8000在/ home / Ubuntu的/雅司病/ WWW /试用 -
=信息报告==== 16月 - 2012 :: 17:21:06 ===
雅司病:听0.0.0.0:4443为< 1>虚拟服务器:
-
当我尝试访问的网址(http://ec2-72-44-47-235.compute-1.amazonaws.com),它从来没有连接。我已经使用耙平,检查端口80或8000是开放的(HTTP://$c$c.google.com/p/paping/)试过,我得到一个主机无法解析的错误,所以很明显的东西是行不通的。
我也试着设置yaws.conf因此它在端口80,出现这样的:
端口= 8000
听= 0.0.0.0
文档根目录= /家庭/ Ubuntu的/雅司病/ WWW /测试
dir_listings =真
和我得到了以下错误:
=错误报告==== 16月 - 2012 :: 17:24:47 === 雅司病:无法听0.0.0.0:80:{错误,EACCES}
=错误报告==== 16月 - 2012 :: 17:24:47 === 不能听套接字:{错误,EACCES} =错误报告==== 16月 - 2012 :: 17:24:47 === PROC顶死,终止gserv =错误报告==== 16月 - 2012 :: 17:24:47 === PROC顶死,终止gserv =信息报告==== 16月 - 2012 :: 17:24:47 === 应用:雅司病 退出:{关机,{yaws_app,启动,[正常,[]]}} 类型:永久 {内核PID终止,application_controller {application_start_failure,雅司病,>>>>>> {关机,> {yaws_app,启动,[正常,[]]}}}}
我还开了80端口使用iptables。运行sudo的iptables的-L给出了这样的输出:
链输入(政策接受) 针对PROT选择源目标 接受TCP - IP-192-168-2-0.ec2.internal IP-192-168-2-16.ec2.internal TCP DPT:HTTP 接受TCP - 0.0.0.0任何地方TCP DPT:HTTP 接受所有 - 任何地方的任何地方ctstate相关,ESTABLISHED 接受TCP - 任何地方的任何地方TCP DPT:HTTP 接受TCP - 任何地方的任何地方TCP DPT:HTTP
链FORWARD(政策接受) 针对PROT选择源目标
链输出(政策接受) 针对PROT选择源目标
感谢您的耐心
解决方案其实,我找到了答案,为什么我不能得到它的工作,通过这个论坛上发帖(http://www.trapexit.org/forum /viewtopic.php?p=42923)。
它指出:
2A。我在8080上运行雅司病,并有nginx的反向代理
从http:// MYDOMAIN:80〜8080雅司将不作为运行
低权限的用户,如果你想它在端口进行侦听
80。
2B。 nginx.conf中需要下列指令:
服务器 {
听80;
SERVER_NAME yourdomain.com;
访问日志/path/to/access/log.log
位置 / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect默认;
}
}
基本上,我安装了nginx的,并配置它作为代理服务器运行。
我已经使用,以获得芝加哥老板框架来运行相同的解决方案,唯一的区别是,我有nginx的proxy_pass设置> HTTP://127.0.0:8001因为芝加哥老板默认运行在8001。任何人都知道这是如何影响一个Erlang服务器的并发优势,如果有人使用nginx的作为代理服务器,或者它有没有效果什么那么?
I'm trying to get a Yaws web server working on a cloud service (Amazon AWS). I've compilled and installed a local copy on the server. My problem is that I can't get Yaws to run while running on either port 8000 or port 80.
I have the following configuration in yaws.conf:
port = 8000
listen = 0.0.0.0
docroot = /home/ubuntu/yaws/www/test
dir_listings = true
This produces the following successful launch/result:
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: -
When I try to access the the url (http://ec2-72-44-47-235.compute-1.amazonaws.com), it never connects. I've tried using paping to check if port 80 or 8000 is open(http://code.google.com/p/paping/) and I get a "Host can not be resolved" error, so obviously something isn't working.
I've also tried setting the yaws.conf so its at Port 80, appearing like this:
port = 8000
listen = 0.0.0.0
docroot = /home/ubuntu/yaws/www/test
dir_listings = true
and I get the following error:
=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,[]]}}}"}
I've also opened up the port 80 using iptables. Running sudo iptables -L gives this output:
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
Thanks for the patience
解决方案Actually, I found the answer to why I couldn't get it to work, through this forum post (http://www.trapexit.org/forum/viewtopic.php?p=42923).
It states:
2a. I run yaws on 8080 and have nginx reverse proxying
from http://mydomain:80 to 8080. Yaws won't run as a
low-privilege user if you want it to listen on port
80.
2b. nginx.conf needs the following directives:
server {
listen 80;
server_name yourdomain.com;
access_log /path/to/access/log.log
location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect default;
}
}
Basically, I installed nginx, and configured it to run as a proxy server.
I have used the same solution in order to get a Chicago Boss framework to run, the only difference is that I have nginx proxy_pass set to >http://127.0.0:8001 since Chicago Boss runs on 8001 by default. Anyone know how this effects an erlang servers concurrency advantages if someone is using nginx as a proxy server, or it has no effect what so ever?