Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...