Index file

DATE : 2023/10/26

[ Index file ]

์•ž์—์„œ ์‚ดํŽด๋ณธ ์ƒํ™ฉ์„ ์ •๋ฆฌํ•ด๋ณด๋ฉด

  • protocol://hostname:port/file_path

  • protocol://hostname/file_path

์™€ ๊ฐ™์ด port๊ฐ€ ๋ช…์‹œ๋œ ๊ฒฝ์šฐ, ์•„๋‹Œ ๊ฒฝ์šฐ๋กœ ๋‚˜๋ˆŒ ์ˆ˜ ์žˆ๋Š” ๋ฐ

์ด๋ฒˆ์— ์‚ดํŽด๋ณผ ๋‚ด์šฉ์€ file path๊ฐ€ ๋ช…์‹œ๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ์ด๋‹ค.

http://192.168.183.129:1018/

๋งŒ์•ฝ์— ์ด์™€ ๊ฐ™์ด file path๋ฅผ ์ƒ๋žตํ•œ ์ƒํƒœ๋กœ URL์„ ์ž…๋ ฅํ•˜๋ฉด ์–ด๋–ค ๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ค๊ฒŒ ๋ ๊นŒ??

๊ฒฐ๊ณผ ํ™”๋ฉด์„ ๋ณด๋ฉด ํ˜„์žฌ ๊ฒฝ๋กœ์— ์–ด๋–ค directory์™€ ํŒŒ์ผ์ด ๋“ค์–ด์žˆ๋Š” ์ง€๋ฅผ ๋ณด์—ฌ์ฃผ๊ณ  ์žˆ๋‹ค.

[+] ์ด๋Š” directory listing ์ทจ์•ฝ์ ์œผ๋กœ ์•…์šฉ๋  ์ˆ˜ ์žˆ์Œ!

ํ•˜์ง€๋งŒ Browser์— naver, google ์„ ์ž…๋ ฅํ•ด๋ณด๋ฉด ํŽ˜์ด์ง€๊ฐ€ ์ถœ๋ ฅ ๋˜๋˜๋ฐ??

์ด๊ฒŒ ์–ด๋–ป๊ฒŒ ๋œ ์ผ์ด๋ƒ!! ํ•˜๋ฉด

์ž…๋ ฅํ•œ URL์˜ file path ๋ถ€๋ถ„์ด ๋น„์–ด์žˆ์„ ๊ฒฝ์šฐ,

ํŒŒ์ผ์„ ์š”์ฒญํ•œ directory์— index file์ด ์กด์žฌํ•œ๋‹ค๋ฉด ๊ทธ ํŒŒ์ผ์ด ๋ณด๋‚ด์ฃผ๋Š” ๊ฒƒ์ด๋‹ค.

๊ทธ๋ž˜์„œ naver๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ๋“ค์–ด๊ฐ”์„ ๋•Œ ๋ณด์ด๋Š” ํŽ˜์ด์ง€์™€

๋™์ผํ•œ ๊ฒฝ๋กœ์˜ index.html์„ ์š”์ฒญํ•œ ๊ฒฐ๊ณผ ํŽ˜์ด์ง€๊ฐ€ ๊ฐ™์€ ๊ฑธ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ฒฐ๋ก ์ ์œผ๋กœ Index file์€

file path๋ฅผ ๋ช…์‹œํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ ์ œ๊ณต๋˜๋Š” ํŽ˜์ด์ง€์ธ ์…ˆ์ด๋‹ค.

๋‹ค๋ฅธ ๋ง๋กœ file path๋ฅผ ์ž…๋ ฅํ•˜์ง€ ์•Š์€ ์š”์ฒญ์„ ๋ณด๋‚ด๋Š” ๊ฑด index file์„ ๋‹ฌ๋ผ๋Š” ์š”์ฒญ๊ณผ ๊ฐ™๋‹ค!

(๋‹ค๋งŒ ์œ„์—์„œ ๋ดค๋“ฏ์ด index file์ด ์กด์žฌํ•  ๋•Œ๋งŒ index file์ด ์ œ๊ณต ๋œ๋‹ค๋Š” ์ !)

์ถ”๊ฐ€์ ์œผ๋กœ ํ•œ ๊ฐ€์ง€ ๋” ์‚ดํŽด๋ณด์ž๋ฉด

index file์€ web root ๊ฒฝ๋กœ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ๊ฐ directory๋งˆ๋‹ค ์ ์šฉ๋œ๋‹ค.

webApp directory(ํ˜„์žฌ web root ๊ฒฝ๋กœ)์— index.html์„ ๋งŒ๋“ค์–ด์ฃผ๊ณ 

์•ž์—์„œ ์‚ฌ์šฉํ–ˆ๋˜ URL์„ ๋‹ค์‹œ ํ•œ ๋ฒˆ ์ž…๋ ฅํ•ด๋ณด๋ฉด

index.html ๋‚ด์šฉ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

files directory์—๋„ index.html์„ ๋งŒ๋“ค์–ด์ฃผ๊ณ 

http://192.168.183.129:1018/files/

๋ฅผ ์ž…๋ ฅํ•˜๋ฉด index file์ด ์กด์žฌํ•˜๊ธฐ ๋•Œ๋ฌธ์—

์ด์™€ ๊ฐ™์€ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์„ ๊ฒƒ!

[ summary ]

(1) index file = ์•„๋ฌด๋Ÿฐ file path ๊ฐ’์ด ๋ช…์‹œ๋˜์ง€ ์•Š์„ ๊ฒฝ์šฐ ์ œ๊ณต๋˜๋Š” ํŒŒ์ผ

(2) file name์ด ๋ช…์‹œ๋˜์ง€ ์•Š์œผ๋ฉด ํ•ด๋‹น directory์˜ index file ๋‚ด์šฉ์ด ์ถœ๋ ฅ๋œ๋‹ค.

(3) index file์€ ๊ฐ directory๋งˆ๋‹ค ์ ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค!

Last updated