无法在 EC2 (Amazon Linux) 上侦听 https 端口 443
我正在 EC2 上运行 Amazon Linux 映像。但是,当我启动 Twisted 服务器时,我无法打开端口 443。
我创建了一个安全组并验证该实例正在使用它,该安全组允许 HTTPS 上的流量。 (HTTPS TCP 443 443 0.0.0.0/0)。
这是输出:
ERROR:root:Exception launching the json rpc server
Traceback (most recent call last):
File "start_ipns_proxy.py", line 27, in launch_json_rpc
RPC_SSL_CERTIFICATE_FILE))
File "/home/ec2-user/ipns_proxy/push_notify/twisted/internet/posixbase.py", line 444, in listenSSL
p.startListening()
File "/home/ec2-user/ipns_proxy/push_notify/twisted/internet/tcp.py", line 857, in startListening
raise CannotListenError, (self.interface, self.port, le)
CannotListenError: Couldn't listen on any:443: [Errno 13] Permission denied.
它在我的本地机器上工作得很好,当我将端口更改为 80 时,我仍然遇到问题(HTTP 也在我的安全组中)。我也重新启动了实例,但没有运气。
编辑:
Here is my netstat output
[ec2-user@domU-12-31-38-04-1E-EC push_notify]$ sudo netstat -nupt -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1559/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1592/sendmail: acce
udp 0 0 0.0.0.0:68 0.0.0.0:* 1428/dhclient
udp 0 0 10.220.29.22:123 0.0.0.0:* 1572/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1572/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1572/ntpd
I am running an Amazon Linux image on EC2. However, I cannot open port 443 when I launch my twisted server.
I created a security group and verified that the instance was using it which allowed traffic on HTTPS. (HTTPS tcp 443 443 0.0.0.0/0).
Here is the output:
ERROR:root:Exception launching the json rpc server
Traceback (most recent call last):
File "start_ipns_proxy.py", line 27, in launch_json_rpc
RPC_SSL_CERTIFICATE_FILE))
File "/home/ec2-user/ipns_proxy/push_notify/twisted/internet/posixbase.py", line 444, in listenSSL
p.startListening()
File "/home/ec2-user/ipns_proxy/push_notify/twisted/internet/tcp.py", line 857, in startListening
raise CannotListenError, (self.interface, self.port, le)
CannotListenError: Couldn't listen on any:443: [Errno 13] Permission denied.
It was working just fine on my local box, and when I change the port to 80 I still have the issue (HTTP was also in my security group). I also rebooted the instance and no luck.
EDIT:
Here is my netstat output
[ec2-user@domU-12-31-38-04-1E-EC push_notify]$ sudo netstat -nupt -l
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1559/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1592/sendmail: acce
udp 0 0 0.0.0.0:68 0.0.0.0:* 1428/dhclient
udp 0 0 10.220.29.22:123 0.0.0.0:* 1572/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1572/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1572/ntpd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能正在运行使用低于 1024 的端口的程序。
尝试使用 root 或 sudo 运行该程序。
You might be running the program that uses port lower than 1024.
Try running the program using root or sudo.
您的计算机上是否有另一台服务器已在侦听端口 443?在我看来,该端口已被另一个进程打开,因此您的进程无法访问它。
Do you have another server on the machine already listening on port 443? It sounds to me like the port is opened by another process so your process can't access it.