Proxy-pass

  • Published on
    nodejs를 이용해 socket.io를 사용하는 경우 보통 포트번호가 다음과 같이 들어가기 마련이다. somewhere.com:9000 하지만 포트 번호가 노출되는것이 영~ 깨림찍한 경우엔 앞딴에 nginx 나 apache 를 두고 뒷딴의 9000포트로 프록시를 하는 것이 보통이다. 개인적으로는 아파치도 좋치만 nginx를 더 자주쓰고 있다. nginx 를 쓴다면 아래와 같이 설정을 추가한다. server { listen 80; root /app/node-server/dist/public; index index.html index.htm; # Make site accessible from http://localhost/ server_name somewhere.com; location / { // A: Proxy 패스를 설정하고 싶은 경우, proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy