![无法使用公共 IP 地址连接到 Linux Ubuntu Azure VM](https://linux22.com/image/1028157/%E6%97%A0%E6%B3%95%E4%BD%BF%E7%94%A8%E5%85%AC%E5%85%B1%20IP%20%E5%9C%B0%E5%9D%80%E8%BF%9E%E6%8E%A5%E5%88%B0%20Linux%20Ubuntu%20Azure%20VM.png)
无法使用公共 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.