{"id":10877,"date":"2025-09-07T11:05:31","date_gmt":"2025-09-07T02:05:31","guid":{"rendered":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=10877"},"modified":"2025-09-10T16:43:23","modified_gmt":"2025-09-10T07:43:23","slug":"nginx-proxy-%ec%84%a4%ec%a0%95","status":"publish","type":"post","link":"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=10877","title":{"rendered":"nginx proxy \uc124\uc815"},"content":{"rendered":"<h1>nginx proxy \uc124\uc815<\/h1>\n<p><a href=\"https:\/\/web.skyer9.pe.kr\">https:\/\/web.skyer9.pe.kr<\/a> -&gt; <a href=\"https:\/\/dev-api.skyer9.pe.kr:8443\">https:\/\/dev-api.skyer9.pe.kr:8443<\/a> -&gt; <a href=\"http:\/\/localhost:9000\">http:\/\/localhost:9000<\/a> \uc73c\ub85c\uc758 \ud638\ucd9c \uc804\ub2ec\uc744 \ucc98\ub9ac\ud569\ub2c8\ub2e4.<\/p>\n<p>nginx \uc5d0\uc11c\ub294 ssl \ucc98\ub9ac\ub97c \ud574\uc57c \ud558\uace0, CORS \ub97c \ucc98\ub9ac\ud569\ub2c8\ub2e4.<\/p>\n<h2>\uc124\uc815<\/h2>\n<pre><code class=\"language-nginx\"># dev-api.skyer9.pe.kr:8443 -&gt; localhost:9000 \ud504\ub85d\uc2dc \uc124\uc815\nserver {\n    listen 8443 ssl;\n    server_name dev-api.skyer9.pe.kr;\n\n    # SSL \uc778\uc99d\uc11c \uc124\uc815\n    ssl_certificate \/home\/skyer9\/cert\/fullchain.pem;\n    ssl_certificate_key \/home\/skyer9\/cert\/privkey.pem;\n\n    # SSL \ubcf4\uc548 \uc124\uc815\n    ssl_protocols TLSv1.2 TLSv1.3;\n    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;\n    ssl_prefer_server_ciphers off;\n    ssl_session_cache shared:SSL:10m;\n    ssl_session_timeout 10m;\n\n    # \ud504\ub85d\uc2dc \uc124\uc815\n    location \/ {\n        proxy_pass http:\/\/localhost:9000;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        proxy_set_header X-Forwarded-Port $server_port;\n        # proxy_set_header User-Agent $http_user_agent; # \uc790\ub3d9\uc73c\ub85c \uc804\ub2ec\ub428\n\n        # CORS \ud5e4\ub354 \ucd94\uac00\n        add_header &#039;Access-Control-Allow-Origin&#039; &#039;https:\/\/web.skyer9.pe.kr&#039; always;\n        add_header &#039;Access-Control-Allow-Methods&#039; &#039;GET, POST, PUT, DELETE, OPTIONS, PATCH&#039; always;\n        add_header &#039;Access-Control-Allow-Headers&#039; &#039;DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization&#039; always;\n        add_header &#039;Access-Control-Allow-Credentials&#039; &#039;true&#039; always;\n\n        # Preflight \uc694\uccad \ucc98\ub9ac\n        if ($request_method = &#039;OPTIONS&#039;) {\n            add_header &#039;Access-Control-Allow-Origin&#039; &#039;https:\/\/web.skyer9.pe.kr&#039;;\n            add_header &#039;Access-Control-Allow-Methods&#039; &#039;GET, POST, PUT, DELETE, OPTIONS, PATCH&#039;;\n            add_header &#039;Access-Control-Allow-Headers&#039; &#039;DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization&#039;;\n            add_header &#039;Access-Control-Max-Age&#039; 1728000;\n            add_header &#039;Content-Type&#039; &#039;text\/plain; charset=utf-8&#039;;\n            add_header &#039;Content-Length&#039; 0;\n            return 204;\n        }\n\n        # \ud0c0\uc784\uc544\uc6c3 \uc124\uc815\n        proxy_connect_timeout 30s;\n        proxy_send_timeout 30s;\n        proxy_read_timeout 30s;\n\n        # \ubc84\ud37c \uc124\uc815\n        proxy_buffering on;\n        proxy_buffer_size 4k;\n        proxy_buffers 8 4k;\n    }\n\n    # \ub85c\uadf8 \uc124\uc815\n    # access_log \/var\/log\/nginx\/dev-api.skyer9.pe.kr.access.log;\n    # error_log \/var\/log\/nginx\/dev-api.skyer9.pe.kr.error.log;\n}<\/code><\/pre>\n<h2>SSL\/TLS \ubcf4\uc548 \uc124\uc815<\/h2>\n<ul>\n<li>ssl_certificate: SSL \uc778\uc99d\uc11c \ud30c\uc77c \uacbd\ub85c (\uacf5\uac1c\ud0a4 \ud3ec\ud568)<\/li>\n<li>ssl_certificate_key: SSL \uac1c\uc778\ud0a4 \ud30c\uc77c \uacbd\ub85c<\/li>\n<li>ssl_protocols TLSv1.2 TLSv1.3: \uc0ac\uc6a9\ud560 TLS \ud504\ub85c\ud1a0\ucf5c \ubc84\uc804 \uc81c\ud55c (\ubcf4\uc548\uc0c1 \uad6c\ubc84\uc804 \ucc28\ub2e8)<\/li>\n<li>ssl_ciphers: \ud5c8\uc6a9\ud560 \uc554\ud638\ud654 \uc54c\uace0\ub9ac\uc998 \ubaa9\ub85d (\uac15\ub825\ud55c \uc554\ud638\ud654\ub9cc \ud5c8\uc6a9)<\/li>\n<li>ssl_prefer_server_ciphers off: \ud074\ub77c\uc774\uc5b8\ud2b8\uac00 \uc120\ud638\ud558\ub294 \uc554\ud638\ud654 \ubc29\uc2dd \uc6b0\uc120 \uc0ac\uc6a9<\/li>\n<li>ssl_session_cache shared:SSL:10m: SSL \uc138\uc158\uc744 10MB \uba54\ubaa8\ub9ac\uc5d0 \uce90\uc2dc\ud558\uc5ec \uc131\ub2a5 \ud5a5\uc0c1<\/li>\n<li>ssl_session_timeout 10m: SSL \uc138\uc158 \uce90\uc2dc \uc720\uc9c0 \uc2dc\uac04 (10\ubd84)<\/li>\n<\/ul>\n<h2>\ud504\ub85d\uc2dc \uc124\uc815<\/h2>\n<ul>\n<li>proxy_pass <a href=\"http:\/\/localhost:9000\">http:\/\/localhost:9000<\/a>: \uc694\uccad\uc744 \ub85c\uceec 9000\ubc88 \ud3ec\ud2b8\ub85c \uc804\ub2ec<\/li>\n<li>proxy_set_header Host $host: \uc6d0\ubcf8 \ud638\uc2a4\ud2b8\uba85 \uc804\ub2ec<\/li>\n<li>proxy_set_header X-Real-IP $remote_addr: \ud074\ub77c\uc774\uc5b8\ud2b8\uc758 \uc2e4\uc81c IP \uc8fc\uc18c \uc804\ub2ec<\/li>\n<li>proxy_set_header X-Forwarded-For: \ud504\ub85d\uc2dc \uccb4\uc778\uc744 \ud1b5\uacfc\ud55c \ubaa8\ub4e0 IP \uc8fc\uc18c \uae30\ub85d<\/li>\n<li>proxy_set_header X-Forwarded-Proto $scheme: \uc6d0\ubcf8 \ud504\ub85c\ud1a0\ucf5c(http\/https) \uc815\ubcf4 \uc804\ub2ec<\/li>\n<li>proxy_set_header X-Forwarded-Port $server_port: \uc6d0\ubcf8 \ud3ec\ud2b8 \ubc88\ud638 \uc804\ub2ec<\/li>\n<\/ul>\n<h2>CORS(Cross-Origin Resource Sharing) \uc124\uc815<\/h2>\n<ul>\n<li>Access-Control-Allow-Origin: <a href=\"https:\/\/web.skyer9.pe.kr\">https:\/\/web.skyer9.pe.kr<\/a> \uc5d0\uc11c\ub9cc API \uc811\uadfc \ud5c8\uc6a9<\/li>\n<li>Access-Control-Allow-Methods: \ud5c8\uc6a9\ud560 HTTP \uba54\uc11c\ub4dc \uc9c0\uc815<\/li>\n<li>Access-Control-Allow-Headers: \ud5c8\uc6a9\ud560 \uc694\uccad \ud5e4\ub354 \uc9c0\uc815<\/li>\n<li>Access-Control-Allow-Credentials: \uc778\uc99d \uc815\ubcf4 \ud3ec\ud568 \uc694\uccad \ud5c8\uc6a9<\/li>\n<\/ul>\n<h2>OPTIONS \uc694\uccad \ucc98\ub9ac (Preflight)<\/h2>\n<ul>\n<li>if ($request_method = &#8216;OPTIONS&#8217;): CORS preflight \uc694\uccad \ucc98\ub9ac<\/li>\n<li>Access-Control-Max-Age 1728000: Preflight \uacb0\uacfc\ub97c 20\uc77c\uac04 \uce90\uc2dc<\/li>\n<li>return 204: \ube48 \uc751\ub2f5\uc73c\ub85c OPTIONS \uc694\uccad \uc644\ub8cc<\/li>\n<\/ul>\n<h2>\uc131\ub2a5 \ubc0f \ud0c0\uc784\uc544\uc6c3 \uc124\uc815<\/h2>\n<ul>\n<li>proxy_connect_timeout 30s: \ubc31\uc5d4\ub4dc \uc11c\ubc84 \uc5f0\uacb0 \ub300\uae30 \uc2dc\uac04<\/li>\n<li>proxy_send_timeout 30s: \ubc31\uc5d4\ub4dc\ub85c \ub370\uc774\ud130 \uc804\uc1a1 \uc81c\ud55c \uc2dc\uac04<\/li>\n<li>proxy_read_timeout 30s: \ubc31\uc5d4\ub4dc\ub85c\ubd80\ud130 \uc751\ub2f5 \ub300\uae30 \uc2dc\uac04<\/li>\n<li>proxy_buffering on: \uc751\ub2f5 \ubc84\ud37c\ub9c1 \ud65c\uc131\ud654 (\uc131\ub2a5 \ud5a5\uc0c1)<\/li>\n<li>proxy_buffer_size 4k: \ucd08\uae30 \uc751\ub2f5 \ubc84\ud37c \ud06c\uae30<\/li>\n<li>proxy_buffers 8 4k: \uc751\ub2f5 \ub370\uc774\ud130\uc6a9 \ubc84\ud37c \uac1c\uc218\uc640 \ud06c\uae30<\/li>\n<\/ul>\n<h2>\ub85c\uadf8 \uc124\uc815<\/h2>\n<ul>\n<li>access_log: \uc811\uadfc \ub85c\uadf8 \ud30c\uc77c \uacbd\ub85c<\/li>\n<li>error_log: \uc5d0\ub7ec \ub85c\uadf8 \ud30c\uc77c \uacbd\ub85c<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>nginx proxy \uc124\uc815 https:\/\/web.skyer9.pe.kr -&gt; https:\/\/dev-api.skyer9.pe.kr:8443 -&gt; http:\/\/localhost:9000 \uc73c\ub85c\uc758 \ud638\ucd9c \uc804\ub2ec\uc744 \ucc98\ub9ac\ud569\ub2c8\ub2e4. nginx \uc5d0\uc11c\ub294 ssl \ucc98\ub9ac\ub97c \ud574\uc57c \ud558\uace0, CORS \ub97c \ucc98\ub9ac\ud569\ub2c8\ub2e4. \uc124\uc815 # dev-api.skyer9.pe.kr:8443 -&gt; localhost:9000 \ud504\ub85d\uc2dc \uc124\uc815 server { listen 8443 ssl; server_name dev-api.skyer9.pe.kr; # SSL \uc778\uc99d\uc11c \uc124\uc815 ssl_certificate \/home\/skyer9\/cert\/fullchain.pem; ssl_certificate_key \/home\/skyer9\/cert\/privkey.pem; # SSL \ubcf4\uc548 \uc124\uc815 ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384; ssl_prefer_server_ciphers off; ssl_session_cache\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.skyer9.pe.kr\/wordpress\/?p=10877\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-10877","post","type-post","status-publish","format-standard","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10877"}],"version-history":[{"count":5,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10877\/revisions"}],"predecessor-version":[{"id":10882,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/10877\/revisions\/10882"}],"wp:attachment":[{"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyer9.pe.kr\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}