无法使用公共 IP 地址连接到 Linux Ubuntu Azure VM。
我已经尝试了一切。
- 激活“ufw”并允许端口 80
username@LinuxLR:\~$ sudo ufw status
Status: active
​
To Action From
\-- ------ ----
80 ALLOW Anywhere
443 ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)
- 我发现了一些关于强制启用端口 80 上的流量的方法
sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
- 使用本地主机进行测试。“curl localhost”抓取页面上的 html。“curl public ip address”没有给出响应。实际上什么都没有发生。
username@LinuxLR:\~$ curl http://127.0.0.1/
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="[http://nginx.org/](http://nginx.org/)">nginx.org</a>.<br/>
Commercial support is available at
<a href="[http://nginx.com/](http://nginx.com/)">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>```
4. Similar thing with wget. "wget localhost" grabs the usual nginx html page. "wget public ip address" does:
```username@LinuxLR:\~$ wget "public ip address"
\--2022-10-19 19:40:43-- "public ip address"
Connecting to "public ip address"... failed: Connection timed out.
Retrying.