AJc*_*dez 8 dns ubuntu azure node.js azure-virtual-machine
我在Azure上有一个Ubuntu虚拟机.我在azure管理门户中添加了一个enpoint:
NAME PROTOCOL PUBLIC PORT PRIVATE PORT LOAD-BALANCED SET
---------------------------------------------------------------
HTTP TCP 80 80 -
Run Code Online (Sandbox Code Playgroud)
我试着听听它:
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);
Run Code Online (Sandbox Code Playgroud)
它可以工作,如果我ssh并卷曲它:
$ curl localhost:80
Hello World
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试访问它subdomain.cloudapp.net,则不会有任何回复.当公共IP地址访问时,它也不返回任何内容.
我应该使用哪个端口和地址监听节点应用程序以从外部访问它?
我是否需要另一个Azure服务才能访问VM?
如果防火墙出现问题,我将如何启用公共访问?
编辑:
我检查了是否有防火墙,但没有:
$ sudo ufw status
[out :: subdomain.cloudapp.net] Status: inactive
Run Code Online (Sandbox Code Playgroud)
编辑2:
配置了一个不同的ubuntu vm,但它仍然不起作用.试图重启iptables,但没有服务已知:
$ sudo service iptables restart
iptables: unrecognized service
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
不知道你的样品有什么问题.这是我的一系列步骤:
我可以通过ndtest2.cloudapp.net名称远程连接(已删除)并获取"Hello World".
编辑:但是我无法连接到从源代码构建的版本.但是如果我从http://nodejs.org下载二进制文件,我可以连接
| 归档时间: |
|
| 查看次数: |
3765 次 |
| 最近记录: |