사용 가이드

정적 사이트 배포

빌드 결과 디렉터리와 정적 사이트 라우트 설정을 배포합니다.

정적 사이트는 빌드된 파일이 있는 디렉터리를 그대로 배포합니다. 프로젝트가 이미 빌드되었다면 별도의 프레임워크 실행 환경 없이 사용할 수 있습니다.

ntro apps create my-static-site
ntro deploy ./dist --app my-static-site --prod

배포할 디렉터리에 nitroship.json 또는 vercel.json을 두면 cleanUrls, trailingSlash, redirect, header, route 설정을 변환합니다. 둘 다 있으면 nitroship.json을 우선합니다. 다음 설정은 경로 변경과 사용자 지정 404 페이지의 예시입니다.

{
  "version": 2,
  "cleanUrls": true,
  "redirects": [{"source": "/old/:slug", "destination": "/docs/:slug", "statusCode": 308}],
  "routes": [
    {"handle": "filesystem"},
    {"src": "^/.*$", "dest": "/404", "status": 404}
  ]
}

저장소의 examples/hello-static에는 index.html, 404.html, 깨끗한 URL, 응답 헤더와 캐시 가능한 해시 파일 예시가 있습니다. .git, .nitroship, .nitroshipignore는 업로드하지 않으며 .nitroshipignore에 지정한 패턴도 제외합니다. 심볼릭 링크 및 일반 파일이 아닌 항목은 건너뜁니다. 파일을 바꾸려면 새 배포를 생성합니다.