Welcome! Log In Create A New Profile

Advanced

Re: Clarification on Nginx Unit ASGI

Sergey A. Osokin
October 21, 2021 09:36AM
Hi Ahmad,

hope you're doing well these days.

On Thu, Oct 21, 2021 at 11:54:05AM +0600, Ahmad Ismail wrote:
> I asked After Nginx Unit, Do we still need ASGI like Uvicorn, Hypercorn,
> Daphne etc https://stackoverflow.com/q/69642063/1772898
>
> There one comment confused me. The comment says:
>
> nginx unit is an ASGI compliant server; you're replacing
> > uvicorn/hypercorn/daphne/etc. with nginx unit instead. It's a choice you
> > make just like you'd make using either of those three or other alternatives.

Well, unicorn/Hypercorn/Daphnie are Asynchronous Server Gateway Interface
(ASGI) servers, so it's possible to run an ASGI application with any of
them.

It's also true that NGINX Unit is an ASGI server, so it's also possible to run
the same ASGI application on top of NGINX Unit.

> I am not understanding what it means. Does it mean, I have to install both
> nginx and nginx unit where nginx unit is the replacement for uvicorn /
> hypercorn / daphne etc. Or, nginx unit alone can do what nginx + uvicorn /
> hypercorn / daphne etc. does.

An answer for the question how to run an application in an evnronment
definitely depends on an application and its architecture. The list of
questions here starts from the following:

- does the application needs caching?
- does the application needs to work with FQDNs or IP addresses?
- does the application needs a session persistance?
- TLS termination on a frontend (NGINX) or backend (NGINX Unit)?
- load balancing

and so on.

> I asked the same question on FastAPI
> <https://github.com/tiangolo/fastapi/issues/3128#issuecomment-947391963>
> github repo
> <https://github.com/tiangolo/fastapi/issues/3128#issuecomment-947391963>.
> There one part of the answer is unclear to me.
>
> > But, but, you will probably need https anyway, I personally prefer some
> > proxy, I didn't even try Nginx Unit "way" of applying tls but there is one
> > apparently. Nginx Ingress, traefik for k8s, nginx proxy manager for swarm,
> > alone traefik docker image or full nginx, probably tens of other solutions.
>
> What I understood is I need to do few more things after installing nginx
> unit. However, the above quote is not clear to me. Can anyone please
> explain what he meant by it. And do I need to install other stuff after
> installing nginx unit?

It's easy to start to work with NGINX Unit, deploy an application and see
how it works. In case you need an additional functionality, it's possible
to extend that with NGINX in front.

Hope it's clear.

--
Sergey Osokin
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Clarification on Nginx Unit ASGI

ismail783 October 21, 2021 01:56AM

Re: Clarification on Nginx Unit ASGI

Sergey A. Osokin October 21, 2021 09:36AM

Re: Clarification on Nginx Unit ASGI

ismail783 October 21, 2021 12:30PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 174
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready