위치가 존재하지 않는 경우 Nginx 구성

위치가 존재하지 않는 경우 Nginx 구성

내 구성

    rewrite /silosy /produktsiya/silosy last;

    location /go/ {
        rewrite /go/http\:/(.*) http://$1 permanent;
    }

    if (!-e $request_filename){
        rewrite ^/(.*) /index.php?$query_string;
    }

이제 "/go" 및 "/silosy"를 재정의하면 "if (!-e $request_filename)"이 사용되기 때문에 작동하지 않습니다. 위치 제한을 추가하는 방법은 다음과 같습니다.

location [not (go|silosy)] {
    if (!-e $request_filename){
        rewrite ^/(.*) /index.php?$query_string;
    }
}

nginx 위치에서 "아니요"는 어떻게 검색됩니까?

답변1

"not"이 어떻게 보이는지 모르겠지만 해결책을 찾았습니다.

    rewrite ^/silosy /produktsiya/silosy permanent;
    rewrite ^/go/(.*) http://$1 permanent;

    if (!-e $request_filename){
        rewrite ^/(.*) /index.php?$query_string;
    }

답변2

당신의 것을 if (!-e $request_filename)블록에 넣어보세요 location /. 그것은견줄 나위 없는.

관련 정보