반응형
nginx가 있는 vue: 경로가 일치하지 않습니다.
nginx(1.10.2)를 사용하여 vue(2.1.x)를 셋업하고 있습니다.설정은 다음과 같습니다.
location / {
root /var/lib/myRepo/dist/;
index index.html;
}
이 기능은 'http://localhost:8080/'을 누르면 작동하지만 'http://localhost:8080/products/home'과 같은 다른 URL을 누르면 다음과 같이 표시됩니다.
404 찾을 수 없음
또, 다음과 같이 시도했습니다.
root /var/lib/myRepo/dist/;
location / {
try_files $uri $uri/ index.html$query_string;
}
여기서 문제가 될 수 있는 부분과 이를 수정하는 방법.
다음과 같이 할 수 있습니다.
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
try_files $uri $uri/ @router;
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
}
언급URL : https://stackoverflow.com/questions/41392508/vue-with-nginx-path-not-matching
반응형
'programing' 카테고리의 다른 글
| Vue.js 2 및 auth0 인증 결과 'nonce'가 됩니다. (0) | 2022.07.27 |
|---|---|
| 가입은 게으른 사람들을 위한 건가요? (0) | 2022.07.27 |
| Java에서 getPath(), getAbsolutePath() 및 getCanonicalPath()의 차이점은 무엇입니까? (0) | 2022.07.27 |
| 스탠포드 튜토리얼과 GCC의 경합 (0) | 2022.07.27 |
| 사이트 로드 시 nuxtServerInit이 여러 번 호출되는 이유 (0) | 2022.07.27 |