반응형
Nginx 위치 우선 순위
위치 지시문은 어떤 순서로 실행됩니까?
로부터 HttpCoreModule 워드 프로세서 :
- 쿼리와 정확히 일치하는 "="접두사를 가진 지시문 발견되면 검색이 중지됩니다.
- 기존 문자열이있는 나머지 모든 지시문. 이 일치가 "^ ~"접두사를 사용한 경우 검색이 중지됩니다.
- 구성 파일에 정의 된 순서대로 정규식.
- # 3이 일치하면 해당 결과가 사용됩니다. 그렇지 않으면 # 2의 일치 항목이 사용됩니다.
설명서의 예 :
location = / {
# matches the query / only.
[ configuration A ]
}
location / {
# matches any query, since all queries begin with /, but regular
# expressions and any longer conventional blocks will be
# matched first.
[ configuration B ]
}
location /documents/ {
# matches any query beginning with /documents/ and continues searching,
# so regular expressions will be checked. This will be matched only if
# regular expressions don't find a match.
[ configuration C ]
}
location ^~ /images/ {
# matches any query beginning with /images/ and halts searching,
# so regular expressions will not be checked.
[ configuration D ]
}
location ~* \.(gif|jpg|jpeg)$ {
# matches any request ending in gif, jpg, or jpeg. However, all
# requests to the /images/ directory will be handled by
# Configuration D.
[ configuration E ]
}
여전히 혼란 스러우면 더 자세한 설명이 있습니다.
이 순서대로 실행됩니다.
=
(바로 그거죠)location = /path
^~
(앞으로 일치)location ^~ /path
~
(정규 표현 대소 문자 구분)location ~ /path/
~*
(정규 표현식은 대소 문자를 구분하지 않습니다)location ~* .(jpg|png|bmp)
/
location /path
참고 URL : https://stackoverflow.com/questions/5238377/nginx-location-priority
반응형
'programing tip' 카테고리의 다른 글
파이썬 스레딩에서 join () 사용은 무엇입니까 (0) | 2020.06.03 |
---|---|
마지막 커밋을 취소하는 방법 (0) | 2020.06.03 |
Django의 메타 클래스는 어떻게 작동합니까? (0) | 2020.06.02 |
Google App Engine에서 Java 및 Python 선택 (0) | 2020.06.02 |
"가상이 아닌 (VB에서 재정의 할 수없는) 멤버에서 유효하지 않은 설정 ..."메시지와 함께 예외가 발생하는 이유는 무엇입니까? (0) | 2020.06.02 |