Go (lang) app: nginx reverse agent vs nginx host

I have read some questions about go and nginx, but I can’t find any answers.

I think (I’m not an expert) in net / http go server using nginx as a reverse proxy is different from using nginx to directly host your go application.
If I am wrong, please shout out, okay?

The problem came to me because I need to develop an application (maybe with go, just to learn new things) and have full control of the web server, especially the workers it uses to answer requests Quantity.

So, here comes the question:

>Is it possible to host a go app directly on nginx, or is it nginx that only provides static files (if the answer is “NO “, then the second question doesn’t make much sense)?
>What is the main difference between the above two methods, to be precise, will the different methods affect the configuration?
>I am afraid to tell nginx: “Ok, please use 8 staff” and tell them that the internal web server has nothing…what will happen?

Thank you very much in advance

Is it possible to directly host a go app on nginx

Nginx can communicate with its backend (your application) through a variety of different mechanisms. Some of them are:

> Via CGI / FastCGI (Process Multiplexing)
> Via HTTP (Reverse Proxy)
>Provide static files generated by your application

does the different approaches affects the configuration someway?

Yes, every case is very different.

Ok, use 8 workers, please

This shows FastCGI, I believe what you mean when you say “host applications directly on nginx”.

telling nothing to go’s internal webserver… What would happen?

Each Go FastCGI process will generate many goroutines. These goroutines are multiplexed into software threads, and software threads are Multiplexed to hardware threads, hardware threads are multiplexed to CPU cores.

Go’s net/http server is good enough for a production environment, unless you want to use some nginx-specific features , Otherwise you don’t necessarily need nginx. Only with so many use cases, FastCGI settings make sense. You just increase the overhead.

I have read some about go and nginx questions, but I can’t find any answers.

I think (I am not an expert) use nginx as a reverse proxy in front of the net/http go server and use nginx to directly host your go application It’s different.
If I’m wrong, please shout out, okay?

The problem came to me because I need to develop an application (maybe with go, just to learn new things) and have full control of the web server, especially the workers it uses to answer requests Quantity.

So, here comes the question:

>Is it possible to host a go app directly on nginx, or is it nginx that only provides static files (if the answer is “NO “, then the second question doesn’t make much sense)?
>What is the main difference between the above two methods, to be precise, will the different methods affect the configuration?
>I am afraid to tell nginx: “Ok, please use 8 staff” and tell them that the internal web server has nothing…what will happen?

Thank you very much in advance

Is it possible to directly host a go app on nginx

Nginx can communicate with its backend (your application) through various mechanisms. Some of them are:

>Through CGI / FastCGI (process multiple (Reuse)
>Through HTTP (reverse proxy)
>Provide static files generated by your application

does the different approaches affects the configuration someway?

Yes, every case is very different.

Ok, use 8 workers, please

< p>This shows FastCGI, I believe what you mean when you say “host the application directly on nginx”.

telling nothing to go’s internal webserver… What would happen?

Each Go FastCGI process will generate many goroutines. These goroutines are multiplexed to software threads, software threads are multiplexed to hardware threads, and hardware threads are multiplexed. Multiplexing to the CPU core.

Go’s net/http server is good enough for a production environment, unless you want to use some nginx-specific features, you don’t necessarily need nginx. There are only so many use cases , FastCGI settings are meaningful. You just increase the overhead.

Leave a Comment

Your email address will not be published.