๋ฐ˜์‘ํ˜•

๋กœ์ปฌ ์„œ๋ฒ„๋ฅผ ๋„์›Œ๋†“๊ณ  ์ž‘์—…์ค‘์ธ ๋‚ด์šฉ์ด ์™ธ๋ถ€ ๋„คํŠธ์›Œํฌ์—์„  ์–ด๋–ป๊ฒŒ ์ž‘๋™ํ•˜๋Š”์ง€ ํ…Œ์ŠคํŠธํ•˜๊ณ  ์‹ถ์„ ๋•Œ๊ฐ€ ์žˆ๋‹ค. ์™ธ๋ถ€์—์„œ ์ ‘์†ํ•˜๋ ค๋ฉด ๋กœ์ปฌ ์„œ๋ฒ„์—์„œ ์‚ฌ์šฉํ•˜๋Š” ํฌํŠธ๋ฅผ(3000, 8080 ๋“ฑ...) ์—ด์–ด์•ผ ๋˜๋Š”๋ฐ ๋ณด์•ˆ์— ์ข‹์ง€ ์•Š๊ณ , AWS์— ์˜ฌ๋ฆฌ์ž๋‹ˆ ๋ฒˆ๊ฑฐ๋กญ๋‹ค. ์ด๋•Œ ngrok๋ผ๋Š” ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. ngrok๋Š” ๋ฐฉํ™”๋ฒฝ ๋’ท๋‹จ์— ์žˆ๋Š” ๋กœ์ปฌ ์„œ๋ฒ„๋ฅผ ๋ณด์•ˆ ํ„ฐ๋„์„ ํ†ตํ•ด ๊ณต์šฉ ์ธํ„ฐ๋„ท์— ๋…ธ์ถœ๋˜๋„๋ก ํ•ด์ค€๋‹ค.

 

Ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels.

 

์‹คํ–‰ ๋ฐฉ๋ฒ•


โถ ngrok ํšŒ์›๊ฐ€์ž… ๋ฐ Authtoken ๋ณต์‚ฌ(๋Œ€์‹œ๋ณด๋“œ ์ขŒ์ธก Getting StartedYour Authtoken)

 

โท ngrok ์„ค์น˜

brew install ngrok

 

โธ ํ˜„์žฌ ๊ธฐ๊ธฐ ์ธ์ฆ

ngrok authtoken ๋ณต์‚ฌํ•œํ† ํฐ

 

โน ๋กœ์ปฌ ์„œ๋ฒ„ ์‹คํ–‰ (React ํ”„๋กœ์ ํŠธ ์‹คํ–‰)

 

โบ ngrok ํ„ฐ๋„ ์‹คํ–‰

# ๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ•. ์ž…๋ ฅํ•œ ํฌํŠธ ๋ฒˆํ˜ธ๋กœ ํ„ฐ๋„๋ง
ngrok http ํฌํŠธ๋ฒˆํ˜ธ 

# https ์„œ๋ฒ„๋ฅผ ์‹คํ–‰ํ•  ๋•Œ
ngrok http https://localhost:ํฌํŠธ๋ฒˆํ˜ธ 

# /var/log ํด๋” serve (ํด๋” ๊ฒฝ๋กœ๋งŒ ๊ฐ€๋Šฅ)
ngrok http file:///var/log
๋”๋ณด๊ธฐ
ngrok http 8080                      # forward ngrok.io subdomain to port 80
ngrok http example.com:9000          # forward traffic to example.com:9000
ngrok http -subdomain=bar 80         # request subdomain name: 'bar.ngrok.io'
ngrok http -hostname=ex.com 1234     # request tunnel 'ex.com' (DNS CNAME)
ngrok http -auth='falken:joshua' 80  # enforce basic auth on tunnel endpoint
ngrok http -host-header=ex.com 80    # rewrite the Host header to 'ex.com'
ngrok http file:///var/log           # serve local files in /var/log
ngrok http https://localhost:8443    # forward to a local https server

 

์ ‘์† ํ…Œ์ŠคํŠธ


ํ„ฐ๋„์„ ์‹คํ–‰ํ•˜๋ฉด ๋Œ€์‹œ๋ณด๋“œ ํ™”๋ฉด์ด ๋‚˜์˜จ๋‹ค. Forwarding์— ๋‚˜์™€์žˆ๋Š” ์ฃผ์†Œ๋กœ ์ ‘์†ํ•ด๋ณด๋ฉด ํ˜„์žฌ ๋กœ์ปฌ์—์„œ ์‹คํ–‰์ค‘์ธ React ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์ ‘์†ํ•  ์ˆ˜ ์žˆ๋‹ค. ์•„๋ž˜ HTTP Requests ๋ถ€๋ถ„์—์„œ ์ ‘์† ํ˜„ํ™ฉ๋„ ์‹ค์‹œ๊ฐ„์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

 

ํ„ฐ๋„์ด ์‹คํ–‰๋  ๋•Œ๋งˆ๋‹ค ์ƒˆ๋กœ์šด URL์ด ๋ถ€์—ฌ๋œ๋‹ค. URL์„ ๊ณ ์ •ํ•ด๋‘๊ณ  ์‚ฌ์šฉํ•˜๋ ค๋ฉด ์œ ๋ฃŒ ๋ฒ„์ „์„ ์จ์•ผ๋œ๋‹ค.

 

Web Interface ์— ๋‚˜์™€์žˆ๋Š” ์ฃผ์†Œ์—์„œ ์ ‘์†ํ•ด๋ณด๋ฉด ๊น”๋”ํ•œ ์ธํ„ฐํŽ˜์ด์Šค์˜ ๋Œ€์‹œ๋ณด๋“œ๋ฅผ ์ œ๊ณตํ•œ๋‹ค.

 

http://127.0.0.1:4040

 


๊ธ€ ์ˆ˜์ •์‚ฌํ•ญ์€ ๋…ธ์…˜ ํŽ˜์ด์ง€์— ๊ฐ€์žฅ ๋น ๋ฅด๊ฒŒ ๋ฐ˜์˜๋ฉ๋‹ˆ๋‹ค. ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ•ด ์ฃผ์„ธ์š”
๋ฐ˜์‘ํ˜•