我已經有一個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