我已经有一个Ubuntu虚拟机在Azure上。我在Azure管理门户加入enpoint:节点哪个端口/ ip地址听天蓝色的Ubuntu vm
我试着听吧:
var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
server.listen(80);
它的工作原理,如果我ssh并卷曲它:
$ curl localhost:80
Hello World
但如果我尝试通过subdomain.cloudapp.net
访问它,则无法返回。当通过公共IP地址访问时,它也不会返回任何内容。
我应该使用我的节点应用程序监听哪个端口和地址才能从外部访问它?
我需要另一个Azure服务才能访问VM吗?
如果它是防火墙的问题,我将如何启用公共访问?
编辑:
我检查,如果有一个防火墙,但没有:
$ sudo ufw status
[out :: subdomain.cloudapp.net] Status: inactive
编辑2:
供应的不同Ubuntu的虚拟机,但它仍然不起作用。尝试重新启动iptables的,但没有服务被称为:
$ sudo service iptables restart
iptables: unrecognized service
iptables的是:
$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:bootpc
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
下载二进制文件你确认端口80在虚拟机的防火墙(iptables)中是否打开? –
我如何确认? (这里很新的服务器的东西) – AJcodez
@DavidMakogon仍然不知道如何允许外部访问,不知道它是否应该使用ACL? – AJcodez