티스토리 뷰

728x90
반응형

PHP에게 아파치가 있다면, nodejs에게는 nginx라는 든든한 웹서버가 있습니다

 

 

우리는 물론 nginx를 통해서도 서버를 생성하여 이미지나 js, css파일 같은 static 파일도 제공이 가능하지만

 

nodejs의 부담을 덜어주기 위해

 

nodejs의 앞단에 nginx를 두어

 

이러한 정적파일들은 nginx가 처리하고,

 

그외는 nodejs로 요청을 넘겨주게끔 하면

 

nodejs를 좀 더 효율적으로 쓸수 있겠죠?

 

nginx에서도 친절하게 설명이 되어있네요

 

https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/

 

NGINX Docs | Serving Static Content

Configure NGINX and NGINX Plus to serve static content, with type-specific root directories, checks for file existence, and performance optimizations.

docs.nginx.com

 

nginx 설정을 마치고 실제로 테스트를 해보면

 

 

nginx가 서빙하는 정적파일들은

 

별다른 설정없이도 자동적으로 etag와 last-modified 헤더가 붙어서

 

클라이언트가 캐싱을 할수 있게 돕습니다

 

 

 

이래저래 참 좋네요

 

 

728x90
반응형
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함