Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
270 views
in Technique[技术] by (71.8m points)

amazon web services - AWS EC2 Instance not showing access to Port 8000

I have setup an AWS EC2 Instance (g4dn.2xlarge). I wanted to setup a flask app on the same and run it using gunicorn and nginx on port 8000. Following all steps listed on multiple sites I did the following:

  1. Updated Inbound Rules on my security group to allow HTTP: Screenshot of Inbound Rules

  2. Checked Outbound Rules: Screenshot of Outbound Rules

  3. Connected to the VM using SSH and ran sudo netstat -tulpn | grep LISTEN.

The output was:

 tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      
 786/systemd-resolve 
 tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1058/sshd           
 tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      592/rpcbind         
 tcp6       0      0 :::22                   :::*                    LISTEN      1058/sshd           
 tcp6       0      0 :::111                  :::*                    LISTEN      592/rpcbind         
 tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN      966/java            
 tcp6       0      0 ::1:9200                :::*                    LISTEN      966/java            
 tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN      966/java            
 tcp6       0      0 ::1:9300                :::*                    LISTEN      966/java 

Why is the system not showing port 8000 as available. I even ran grep 8000 and it gave no results. What should I do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can change the flask app port in app.py file

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)

configure your web server (ex: nginx or apache) to proxy queries to flask port.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...