Nginx에 Tomcat 또는 Node 서버 연결하기

Photo by D koi on Unsplash
$ vim /etc/nginx/sites-available/default
server {   listen 443 ssl;   ...
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080;
}
}
  • proxy_pass: 요청 전달의 대상이 되는 실제 서버
  • proxy_set_header: Nginx에선 기본적으로 “Host”와 “Connection” 헤더를 재정의하고 값이 빈 문자열인 헤더 필드를 제거한다 이 설정을 변경하기 위한 요소이다.

--

--

I love Programming 🧑🏻‍💻 https://github.com/Jay-flow

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store