无法连接EC2 443端口

0

【以下的问题经过翻译处理】 我有一个在端口443上运行Apache HTTPD的CentOS 7 EC2实例。

$ netstat -tnlp | grep 443
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      2533/httpd          

我清除了安全组的所有入站规则,现在只剩下这三个:

IPv4	HTTPS	TCP	443	<MyIP>/32
IPv4	HTTP	TCP	80	<MyIP>/32
IPv4	SSH	TCP	22	<MyIP>/32

故障现象是无法连接到公共IP上的Web服务器(Google Chrome浏览器报告ERR_CONNECTION_TIMED_OUT)。 在我删除一些入站规则并停止实例前几天,它是正常工作的。

$ telnet <public IP> 443
Trying <public IP>...
telnet: connect to address <public IP>: No route to host
$ telnet <public IP> 80 
Trying <public IP>...
telnet: connect to address <public IP>: No route to host
$ telnet google.com 443
Trying 142.250.188.46...
Connected to google.com.
Escape character is '^]'.

还有什么可以检查的吗? 谢谢

更新: 我在实例上安装了VNC服务器,并使用VNC Viewer连接。本地启动Firefox,打开URL https://localhost,能够登录到Web应用程序。但仍然无法使用https://<public ip>访问。

profile picture
전문가
질문됨 5달 전85회 조회
1개 답변
0

【以下的回答经过翻译处理】 使用防火墙命令,在EC2上添加443端口解决了问题

$ sudo firewall-cmd --permanent --add-port=443/tcp

$ sudo firewall-cmd --reload

$ sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources: 
  services: dhcpv6-client ssh
  ports: 3389/tcp 443/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 


profile picture
전문가
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠