오늘의 인기 글
최근 글
최근 댓글
Today
Total
05-05 00:02
관리 메뉴

우노

[Nginx] 변수 사용 방법 본문

Web/Nginx

[Nginx] 변수 사용 방법

운호(Noah) 2023. 3. 27. 14:47

예제 코드) Nginx 변수 선언 및 호출

server {
    listen   3002;
    root     /opt/nginx/html;
    resolver 168.126.63.1 valid=1m ipv6=off;

    # 변수 선언
    set $test 'hello';

    location / {

        proxy_pass http://localhost:3000/;

        # 변수 호출
        proxy_set_header customheader $test;

    }

}

참고

'Web > Nginx' 카테고리의 다른 글

[Nginx] proxy_pass 시 cookie 전달  (0) 2023.03.30
[Nginx] proxy_pass 시 custom header 추가  (0) 2023.03.28
[Nginx] Json 로그 포맷 설정  (0) 2023.03.11
[Nginx] resolver란?  (0) 2023.02.23
[Nginx] 정규표현식  (1) 2023.02.17
Comments