News for hackers. Stuff that matters.
Re:Do svidaniya, Igor, and thank you for Nginx by graderjs on Tuesday January 18, 2022 @11:34PM (#29990007)
I'm an experienced dev with a deep knowledge of full stack web as well as infrastructure but I've never put nginx in front of any app. I want to but I honestly avoided it because I thought it was difficult. This may not be the right place to ask but is there a good guide for someone who's deep into nodejs who just wants to set up nginx on Debian in front of a node server with https? and just see how it goes.
Re:Do svidaniya, Igor, and thank you for Nginx by fdfsdfasdfd on Wednesday January 19, 2022 @01:26AM (#29990624)
I'm just a fool on the internet, but if your appserver is NodeJS, you might want to consider HAProxy over nginx (I say this as a fan of nginx).

The reason being that (unless my information is stale), NodeJS will happily accept all the connections thrown at it, eventually causing each connection to be starved of compute capacity and finally falling over. HAProxy is able to keep a connection queue and feed a maximum of (for example) 4 concurrent requests to the backend(s), thus providing back-pressure to incoming requests. Makes it a lot easier if you need to eventually scale your app horizontally, too.

Re:Do svidaniya, Igor, and thank you for Nginx by CrLf on Wednesday January 19, 2022 @07:38AM (#29992825)
> HAProxy is able to keep a connection queue and feed a maximum of (for example) 4 concurrent requests to the backend(s), thus providing back-pressure to incoming requests.

NGINX can do this as well, either with the "max_conns" parameter for upstreams, or (trickier, but perhaps more effective when the upstream is async) in combination with rate limiting:

    limit_req_zone $server_name zone=root:10m rate=100r/s;
    limit_req_status 429;

    location / {
        limit_req zone=root burst=100 delay=4;
    }
Re:Do svidaniya, Igor, and thank you for Nginx by graderjs on Wednesday January 19, 2022 @02:07AM (#29990817)
Thank you, that's good advice.
Re:Do svidaniya, Igor, and thank you for Nginx by saberdancer on Wednesday January 19, 2022 @02:50AM (#29991020)
Given your experience, it should be extremely simple, especially if all you want to do is drop NginX infront of your NodeJS server. All you have to do is install it and add a line in the config that points traffic to your NodeJs instance. Btw often times people use Nginx as SSL termination and use http to the backend (if on the same instance).

Let's Encrypt can automatically add lines to the nginx config that enable SSL, but in some cases it doesn't work properly and the config is malformed. In any case not hard to fix.

Re:Do svidaniya, Igor, and thank you for Nginx by davidzweig on Tuesday January 18, 2022 @11:56PM (#29990119)
NGINX course on https://acloudguru.com/ is good.
Re:Do svidaniya, Igor, and thank you for Nginx by kkiinnpptt on Wednesday January 19, 2022 @01:05AM (#29990514)
It's not that hard. DigitalOcean has good guides.