I have a ML model with fast api wrapper running on google cloud VM, it runs fine when ssh terminal is open. but once I close the terminal it runs for 10 more minutes maybe and then the api returns 502 bad gate way
I'm using nginx with this config
 server{listen 80; server_name: public ip; location /{proxy_pass http://127.0.0.1:8000;}}
please let me know if there is any way I can fix this problem.
reran everything sill same error
When you close the SSH terminal session, the applications that you started will be killed. Use a program such as tmux, screen, etc. to create sessions that you can attach to and detach from.
However, since you are using Nginx, there are better methods of managing applications that are being proxied. For development, your current method is OK. For production, your proxied applications should be started and managed by the system as a service.
fast api stopping after a while on google cloud vm