How to implement proxy local 3000 port without nginx?

Nginx can be configured as followsexample.com/api/Access the 3000 port of the server,
Three questions:
1. IfNo nginxHow to achieve the same function?
2. Or what did nginx do before it appeared,
3. What is the main function of nginx?
图片描述,I always use niginx. If I don’t use nginx, I think I should run an application to listen to port 80 and forward requests. In this case, it is actually the same thing as nginx.
Nginx is a reverse proxy. Its basic purpose is to listen to port 80 and forward requests according to the rules of the domain name.
In addition to forwarding requests, it can also do many things. You can understand it as Uncle Qin, the gatekeeper of the server. After receiving the request, it will do a series of corresponding processing according to the rules. Sometimes the application will continue to process the request after it is finished.
For node JS, nginx (reverse proxy) is not necessary for some applications, such as PHP.,In fact, the principle of haproxy is similar to nginx. If you want to implement it in the code layer, you have to implement the function of a TCP proxy,Because you are a sub path reverse proxy and a port, you must have software that supports reverse proxy.
Nginx can certainly be configured. In fact, Apache can also be configured (although the performance is not necessarily so good), and squid can also be configured after eating.
Of course, haproxy can also.
In fact, what needs to be understood here is that the final effect is a reverse proxy (mapping from sub path to service port). The specific configuration (Implementation) depends on the specific environment.,No, nginx just use others… All kinds of agent software or web server have agent function

Read more here: Source link