Nginx 가 무엇인고 ?

Q kim·2020년 11월 15일
5

nginx가 왜 궁금한가.

: node.js서버에 대해서 무언가 하고 있을 때마다 nginx라는 키워드가 눈앞에 나타난다. 그래서 궁금하다.

Nginx(엔진 x라 읽는다)는 웹 서버 소프트웨어로, 가벼움과 높은 성능을 목표로 한다. 웹 서버, 리버스 프록시 및 메일 프록시 기능을 가진다. - "https://ko.wikipedia.org/wiki/Nginx"

결론: "nginx는 웹 서버다."


(잠시 Web server, WAS(Web App server)의 차이부터 짚고 넘어가자.)

  • Web Server
    웹 브라우저 클라이언트로부터 HTTP 요청을 받아 정적인 컨텐츠(.html .jpeg .css 등)를 제공하는 컴퓨터 프로그램.
    정적인 컨텐츠 제공 WAS를 거치지 않고 바로 자원을 제공한다.

  • WAS(Web Application Server)
    클라이언트의 요청(Request)을 WAS에 보내고, WAS가 처리한 결과를 클라이언트에게 전달(응답, Response)한다.

web server와 WAS가 뭔지모르던, 헷갈리다면 꼭 링크를 들어가서 읽어보길 권장한다! - https://gmlwjd9405.github.io/2018/10/27/webserver-vs-was.html


다시 돌아와서. "nginx는 웹서버다!"

서버라면 "요청을 받고 응답을 한다."는 건데. "node.js 자체적으로도 다해주는 거 아닌가?" nginx를 굳이 왜 붙이는거지?

굳이 왜 nginx를 붙여서 쓰지?

While many common applications, such as Node.js, are able to function as servers on their own, NGINX has a number of advanced load balancing, security, and acceleration features that most specialized applications lack. Using NGINX as a reverse proxy enables you to add these features to any application. - "https://www.linode.com/docs/guides/use-nginx-reverse-proxy/"

해석하자면 node.js와 같은 어플리케이션이 서버와 같은 역할을 할수 있지만 부족한 부분이 꽤 있다. 예를 들자면 load balancing, security 이러한 것들.
"nginx를 이용하면 이러한 어플리케이션의 부족한 부분들을 쉽게 메꿀수 있다."

Nginx를 이용함으로써 얻는 이점

load balancing

Load Balancing Definition: Load balancing is the process of distributing network traffic across multiple servers. This ensures no single server bears too much demand. By spreading the work evenly, load balancing improves application responsiveness. It also increases availability of applications and websites for users. Modern applications cannot run without load balancers. Over time, software load balancers have added additional capabilities including security and application. - "https://avinetworks.com/what-is-load-balancing/"

해석
로드밸런스 정의: 로드 밸런싱은 네트워크 트레픽을 여러개의 서버로 나누는 과정이다. 한개의 서버에 과도한 트레픽이 몰리지 않게 해준다. 여러개의 서버로 요청을 나눔으로써 어플리케이션의 반응성을 높여준다. 또한 웹사이트와 어플리케이션의 기능성을 향상시킨다.

security

Nginx is a very secure and reliable web server even with a default setup. However, there are many ways to secure Nginx further. - "https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-on-ubuntu-14-04"

Nginx 기본 설정 자체만으로도 node.js를 서버로 쓰는 것보다 안전하다고 한다. 그리고 추가적으로 보안을 확장하기가 쉽다. 또한 client가 node 서버에 접근하기 전에 nginx를 거쳐야 하므로(한 계층이 더 생기므로) 직접적으로 node 서버에 접근할 수 없게 된다. 기본적으로 더 안전해진다. 더 자세한 내용은 맨아래 추가 자료를 확인하시라.

다시 정리하자면

Node.js에서 기본 제공해주는 건 부족하다. nginx를 쓰면 쉽게 서버의 성능과 안정성을 얻을 수 잇다.



추가 자료

profile
https://medium.com/nodejs-server

2개의 댓글

comment-user-thumbnail
2022년 3월 28일

Web Server: Geometry Dash 웹 브라우저 클라이언트로부터 HTTP 요청을 받아 정적인 컨텐츠(.html .jpeg .css 등)를 제공하는 컴퓨터 프로그램.

답글 달기
comment-user-thumbnail
2023년 8월 31일

I adore that you informed me about this article since I think it's amazing. That is exactly what I was hoping to discover, and I sincerely hope you will continue to share such excellent stuff in the years to come. five nights at freddy's

답글 달기