문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
nginx:location [2012/11/07 17:37] kwon37xi 새로 만듦 |
nginx:location [2014/01/22 16:40] kwon37xi |
||
---|---|---|---|
줄 1: | 줄 1: | ||
====== nginx location 설정 ====== | ====== nginx location 설정 ====== | ||
+ | * [[http:// | ||
+ | |||
+ | ===== alias와 root의 차이===== | ||
+ | alias 는 특정 URL이 서빙할 파일 경로를 변경하는 역할을 한다. root와는 역할이 다르다. | ||
+ | < | ||
+ | location / | ||
+ | alias / | ||
+ | } | ||
+ | </ | ||
+ | 이 상태에서 '' | ||
+ | |||
+ | 반면에 '' | ||
+ | |||
+ | ===== 특정 파일 확장자에 대해 Header 추가하기 등의 작업하기 ===== | ||
+ | '' | ||
+ | |||
+ | < | ||
+ | location / { | ||
+ | if ($uri ~ ^(.+)\.(eot|ttf|woff)$) | ||
+ | { | ||
+ | add_header Access-Control-Allow-Origin *; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | 웹폰트에 대해 '' | ||
+ | |||
+ | ===== URL 중간에 정규표현식 있고, 특정 파일로 무조건 보내기 | ||
+ | < | ||
+ | location ~* ^/ | ||
+ | rewrite .* / | ||
+ | } | ||
+ | |||
+ | location ~ / | ||
+ | root / | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== POST redirect ===== | ||
+ | < | ||
+ | location ~* ^/some/test { | ||
+ | return 302 / | ||
+ | } | ||
+ | |||
+ | location ~ / | ||
+ | root / | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== Directory Listing 디렉토리 목록 ===== | ||
+ | * [[http:// | ||
+ | location /somedir { | ||
+ | autoindex on; | ||
+ | } | ||
+ | </ | ||