Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.3K
Vistas
Running fastapi app using uvicorn on ubuntu server

I am dealing with the project deposition made on FastAPI to a remote ubuntu server. I'll try to run the project from terminal (using SSH connection) by the command

gunicorn -k uvicorn.workers.UvicornWorker main:app

The output is

gunicorn -k uvicorn.workers.UvicornWorker main:app
[2020-07-14 15:24:28 +0000] [23102] [INFO] Starting gunicorn 20.0.4
[2020-07-14 15:24:28 +0000] [23102] [INFO] Listening at: http://127.0.0.1:8000 (23102)
[2020-07-14 15:24:28 +0000] [23102] [INFO] Using worker: uvicorn.workers.UvicornWorker
[2020-07-14 15:24:28 +0000] [23104] [INFO] Booting worker with pid: 23104
[2020-07-14 15:24:28 +0000] [23104] [INFO] Started server process [23104]
[2020-07-14 15:24:28 +0000] [23104] [INFO] Waiting for application startup.
[2020-07-14 15:24:28 +0000] [23104] [INFO] Application startup complete.

But I need the project to be available at the IP address of the server. If I try smth like

uvicorn main:app --host 66.226.247.55 --port 8000 

I get

INFO:     Started server process [23308]
INFO:     Waiting for application startup.
INFO:     Connected to database postgresql://recognition:********@localhost:5432/reco
INFO:     Application startup complete.
ERROR:    [Errno 99] error while attempting to bind on address ('66.226.247.55', 8000): cannot assign requested address
INFO:     Waiting for application shutdown.
INFO:     Disconnected from database postgresql://recognition:********@localhost:5432/reco
INFO:     Application shutdown complete.

Where 66.226.247.55 - external IP adress from google cloud platform instances How do I start a project so that it can be accessed via IP?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

The --host should be the local address of your GCP server.

uvicorn main:app --host 0.0.0.0 --port 8000

and now access the application by http://66.226.247.55:8000

Note: You should open your 8000 port of GCP server.

over 4 years ago · Santiago Trujillo Denunciar

0

If you're using nginx server

create a file in /etc/nginx/sites-enabled/ create file touch fastapi_nginx copy code into file and adjust accordingly

server{
    listen 80;
    server_name "your public ip";
    location / {
        proxy_pass http://127.0.0.1:8000; #localhost
    }

}

This should reroute to your public ip

over 4 years ago · Santiago Trujillo Denunciar

0

You cannot launch your fast api app on your local to your remote server in GCP.

You must deploy your app to GCP. In other words you need to run that command on a remote server not your localhost.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda