GET /
을 /srv/app/static/index.html
으로 다시 쓰려고합니다. 나는이 몇 가지 지침을 가까이 해요 : I GET /static
이 nginx를가 /srv/app/static/index.html
에서 파일을 제공하며, 나는 행복 해요nginx는 어떻게 위치 블록에 파일 경로를 구성합니까?
root /srv/app/static;
location /static {
alias /srv/app/static;
}
location =/{
alias /srv/app/static/index.html;
}
그래서.
하지만일 때, nginx는 404를 반환합니다. 로그를 확인하면 파일 /srv/app/static/index.htmlindex.html
(sic)에 액세스하려고하는 것 같습니다. 왜 여분 index.html
을 alias
에 주어진 경로에 집어 넣을까요? 내가
location =/{
index index.html;
alias /srv/app/static/;
}
해당 지침을 변경하면
오류 로그는 /srv/app/static
에서 최종 c
문자를 제거, /srv/app/stati
(원문에 액세스하려고 보여줍니다 여기에 무슨
편집 :.?
:나는이 같은 rewrite
를 사용하여 원하는 동작을 얻을 수 있습니다
그러나 나는 alias
이 더 공감적이고 관용적이라고 생각합니다.