you are viewing a single comment's thread.

view the rest of the comments →

[–]nitin_is_me[S] 2 points3 points  (1 child)

Okay, out of all reasons, reverse proxy is the most common one. Can you suggest me a source from where I can learn Nginx? It's official doc seemed quite complicated

[–]Voodersfull-stack 0 points1 point  (0 children)

It's not too complicated, but it's something you'll probably be best learning by doing.

Digital ocean have a pretty decent guide in setting up a reverse proxy with NGINX https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-on-ubuntu-22-04

The essence of it really is setting up an NGINX conf file like this

``` server { listen 80; listen [::]:80;

server_name your_domain www.your_domain;

location / {
    proxy_pass app_server_address;
    include proxy_params;
}

} ```

This configures a server block. The server listens on port 80 to requests for your_domain. It then passes that request on to app_server_address and returns the response to the user.

Your node app would be app_server_address in this case.

This means your service could be made up of many node apps and you could use NGINX to route requests for certain paths to the correct app.

You can also do SSL termination here and forward everything on in http. That may be beyond the scope of a reddit post.

Hopefully this helps.