'2018/10/30'에 해당되는 글 2건

  1. 2018.10.30 nginx reverse proxy 2
  2. 2018.10.30 js eval
프로그램 사용/nginx2018. 10. 30. 18:51

nginx를 이용해서 http proxy로 사용하는 방법


다른서버 있어서 80은 못쓰고

81번으로 셋팅했고

/test1/ 은 nginx 서버와 동일한 ip의 3001번 포트로 포워딩

/test2/ 는 nginx 서버와 동일한 ip의 3002번 포트로 포워딩 해서 작동한다.


단, node.js나 angular의 경우 상대경로와 절대경로를 조심해서 작성해야 정상적으로 작동하게 된다.

(angular는 안써서 모르겠지만 deploy 시 경로를 잘 지정해야 할지도?)

[링크 : https://itnext.io/angular-cli-proxy-configuration-4311acec9d6f]


의외로 끝에 오는 / 의 역활이 지대하다

    server {

        listen       81 default_server;

        listen       [::]:81 default_server;

        server_name  _;

        root         /usr/share/nginx/html;


        # Load configuration files for the default server block.

        include /etc/nginx/default.d/*.conf;


        location / {

        }


        error_page 404 /404.html;

            location = /40x.html {

        }


        error_page 500 502 503 504 /50x.html;

            location = /50x.html {

        }


        location /test1/ {

                proxy_set_header X-Real-IP $remote_addr;

                proxy_set_header Host $host;

                proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;

                proxy_pass http://localhost:3001/;

        }


        location /test2/ {

                proxy_set_header X-Real-IP $remote_addr;

                proxy_set_header Host $host;

                proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;

                Host proxy_set_header $ HTTP_HOST;

                proxy_pass http://localhost:3002/;

        }

    }

 


[링크 : http://www.codingpedia.org/...-in-production-to-serve-angular-app-and-reverse-proxy-nodejs]

[링크 : https://www.joinc.co.kr/w/man/12/proxy]

[링크 : https://gist.github.com/soheilhy/8b94347ff8336d971ad0]

Posted by 구차니

예전에 lisp에서 우오오 했던거 같은 녀석..

eval() 을 통해서 넘겨받은 데이터를 코드로 실행한다.

즉, array 데이터를 plain/text로 받은걸

다시 array로 복구가 가능 하다는 것!


[링크 : https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/eval]



+

JSON.stringify() 등으로 문자열화 된 객체를 실제 객체로 만드는데 쓰일수도 있다.

[링크 : https://blog.outsider.ne.kr/257]

'Programming > javascript & HTML' 카테고리의 다른 글

html canvas 보이는 크기와 실제 크기 다르게 설정하기  (0) 2018.11.02
js array keys(),values()  (0) 2018.10.31
js split \n ' '  (0) 2018.10.26
curl text/plain  (0) 2018.10.26
js date time to epoch  (0) 2018.10.26
Posted by 구차니