I am trying to create python Flask application accessible from internet on Oracle Cloud compute VM with Oracle Linux 8.6. Example is taken from Ubuntu based tutorial so except modification of iptables
sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport 5000 -j ACCEPT
sudo netfilter-persistent save
where I am using
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload
the process remains the same. Sample application
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
if __name__ == "__main__":
app.run(host="0.0.0.0", port=int("5000"), debug=True)
runs well on private IP address (checked by curl
)
* Serving Flask app 'hi' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment.
* Running on http://10.0.0.184:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 995-235-083
127.0.0.1 - - [22/Mar/2023 11:58:24] "GET / HTTP/1.1" 200 -
but server is not accessible from internet http://public-IP-of-my-instance:5000
. Any idea what I am doing wrong? I have successfully set up Apache web server on the same instance.