InfraStructure/Nginx

nginx 라우팅 우선순위 (location priority)

2mukee 2025. 2. 2. 17:39
320x100
320x100

nginx의 라우팅 우선순위는 conf 파일의 상단에서 하단 순으로 먼저 적용되고,
location의 prefix에 의해 다시 정렬된다.


다음은 location prefix의 우선순위이다

1. = (exactly)
location = /path

2. ^- (forward match)
location ^- /path

3. -, -* (regular expression case sensitive and insensitive)
location - /path
location -* .(jpg|png|tmp)

4. /
location /path




Reference

Nginx location priority

What order do location directives fire in?

stackoverflow.com


300x250
728x90