无法通过 browser/HTTP 访问 Azure Linux 虚拟机
Can't access Azure Linux Virtual Machine via browser/HTTP
我用Redhat在azure中搭建了一个虚拟机Linux OS,我安装了Httpd服务并放置了一个静态网页来访问。
我无法通过在我的 VM 上设置 public IP 的浏览器访问我的 VM。虽然,我可以通过 ssh 进入机器。
我已经尝试过的步骤:
- 为端口 80、443、22(ssh) 设置网络安全组的入站规则。
- 已将此 NSG 附加到 VNET 和 NIC,但没有成功。
- 在 AWS EC2 实例中尝试了同样的方法,它非常有效。不确定为什么 Azure 不是那么简单。
- 试图在网上找到解决方案和文档,但没有成功。
如果您知道如何通过浏览器访问我的应用程序,请提供帮助。
请检查SELINUX配置是否正确
Redhat 参考:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/managing_confined_services/chap-managing_confined_services-the_apache_http_server
谢谢,
马努
感谢 Manu 的建议。但是我发现 Linux 防火墙阻止了它。所以这就是我所做的:
由于我使用的是 RHEL 8,内置防火墙是通过 Firewalld 而不是 iptables(RHEL 6 及之前的版本有)。
1- 默认情况下,firewalld 仅打开端口 22。 “firewall-cmd --list-all”命令将显示详细信息。
2- 添加了 HTTP 端口。通过使用以下 2 个命令
$ sudo firewall-cmd --zone=public --add-service=http --permanent
$ sudo firewall-cmd --reload
3- 使用以下任一命令验证更改:
$ sudo firewall-cmd --list-services
$ sudo firewall-cmd --list-services --permanent
请参阅此link了解更多详情:
https://www.cyberciti.biz/faq/configure-set-up-a-firewall-using-firewalld-on-rhel-8/
我用Redhat在azure中搭建了一个虚拟机Linux OS,我安装了Httpd服务并放置了一个静态网页来访问。
我无法通过在我的 VM 上设置 public IP 的浏览器访问我的 VM。虽然,我可以通过 ssh 进入机器。
我已经尝试过的步骤:
- 为端口 80、443、22(ssh) 设置网络安全组的入站规则。
- 已将此 NSG 附加到 VNET 和 NIC,但没有成功。
- 在 AWS EC2 实例中尝试了同样的方法,它非常有效。不确定为什么 Azure 不是那么简单。
- 试图在网上找到解决方案和文档,但没有成功。
如果您知道如何通过浏览器访问我的应用程序,请提供帮助。
请检查SELINUX配置是否正确 Redhat 参考:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/managing_confined_services/chap-managing_confined_services-the_apache_http_server
谢谢, 马努
感谢 Manu 的建议。但是我发现 Linux 防火墙阻止了它。所以这就是我所做的: 由于我使用的是 RHEL 8,内置防火墙是通过 Firewalld 而不是 iptables(RHEL 6 及之前的版本有)。
1- 默认情况下,firewalld 仅打开端口 22。 “firewall-cmd --list-all”命令将显示详细信息。 2- 添加了 HTTP 端口。通过使用以下 2 个命令
$ sudo firewall-cmd --zone=public --add-service=http --permanent
$ sudo firewall-cmd --reload
3- 使用以下任一命令验证更改:
$ sudo firewall-cmd --list-services
$ sudo firewall-cmd --list-services --permanent
请参阅此link了解更多详情: https://www.cyberciti.biz/faq/configure-set-up-a-firewall-using-firewalld-on-rhel-8/