PHP Yii2 프레임워크를 사용하는 Google 앱 엔진의 404 오류

PHP Yii2 프레임워크를 사용하는 Google 앱 엔진의 404 오류

내 응용 프로그램에는 Angular 및 Php Yii2 프레임워크가 포함되어 있습니다.

Google 클라우드 플랫폼의 앱 엔진에 내 애플리케이션을 호스팅했습니다.

다음은 내 코드와 app.yaml 파일 코드의 스크린샷입니다.

threadsafe: true
runtime: php55
api_version: 2

handlers:

# The root URL (/) is handled by the Go application.
# No other URLs match this pattern.

- url: /(.+)
  static_files: \1
  upload: (.*)

- url: /web-service/*
  script: web-service/yii

- url: /
  static_files: index.html
  upload: index.html

여기에 이미지 설명을 입력하세요

내 Yii2 라이브러리는 웹 서비스 디렉토리에서 사용할 수 있습니다. 우편 배달부에서 나머지 API를 호출하면 404 페이지를 찾을 수 없음 오류가 반환됩니다.

내가 파일에서 무엇을 놓치고 있는지 app.yaml.

이 문제를 해결하도록 도와주세요.

내 API는 다음과 같이 호출됩니다.

https://abcxyz.appspot.com/web-service/web/user-registration/login-user

답변1

URL 처리기의 순서가 올바르지 않습니다.

GAE는 이러한 작업을 위에서 아래로 수행합니다. 첫 번째 핸들러는 모든 것과 일치합니다. 다른 두 개에는 절대 도달하지 않습니다.

app.yaml에서 순서를 변경해야 합니다.

threadsafe: true
runtime: php55
api_version: 2

handlers:

# The root URL (/) is handled by the Go application.
# No other URLs match this pattern.

- url: /
  static_files: index.html
  upload: index.html

- url: /web-service/*
  script: web-service/yii

- url: /(.+)
  static_files: \1
  upload: (.*)

항상 아래쪽에 가장 넓은 부분을 배치하고 위쪽에 가장 엄격한 부분을 배치하는 것이 좋습니다.

GAE app.yaml 문서에서 해당 섹션을 참조하세요.

관련 정보