프로그래밍/WEB

[React, Nginx] nginx에 react 배포시 Not Found

dev_NineFive 2023. 5. 8. 23:58

nginx에 react 빌드 파일을 배포하면

html파일은 찾이만 js, css등 html에서 사용하는 staticfile 호출시 404가 뜨는 경우가 있다.

Failed to load resource: the server responded with a status of 404 (Not Found)

 

react를 build할 때 homepage 옵션이 적용되지 않아 발생한 문제로

package.json에 

{
  ...
  "homepage": "http://rikroy.tistory.com/route/",
  ...
}

위와 같이 homepage 옵션으로 pubilc url을 입력해주면 된다.

'프로그래밍 > WEB' 카테고리의 다른 글

[개념깨기] URI/URL  (0) 2023.07.03
[HTTP] 413 - Payload Too Large  (0) 2023.05.09
[CSS] textarea 크기 조절 제한  (0) 2023.05.09