I'm trying to deploy my FastAPI on lightsail AWS which uses ubuntu. I created a directory in /home/ubunutu named say myapp so, /home/ubuntu/myapp Now I create Virtual Environment in the virtual env and install required libraries. After this I start my gunicorn server on local host which is listening at port 8000.
But whenever I access the serverip:8000 it gives error [Error: connect ECONNREFUSED "server ip address":8000].
I didn't create any ".service" files because I want to make sure first if it runs locally but it isn't running when the same runs on Vs-Code and the same API is deployed on Heroku working as-well.
I even tried to create a sample file using a tutorial and followed the same steps which were also given on the tutorial itself but I got the same error.
The :8000 port is free, I made sure of that. Server is returning API calls on other API's even changed some other API's to port 8000 as-well and there it worked perfect.
The firewall is disabled so that is not the problem as-well.
It just isn't working with Gunicorn.