[Nginx] 리엑트 static 폴더 파일 처리


[Nginx] 리엑트 static 폴더 파일 처리

default.conf # "nginx"에 있는 "default.conf"를 수정합니다. "location ~ .(static)/(js|css|media)/(.+)$" 부분을 추가해주시면 됩니다. server { listen 80; server_name localhost; root /root/react-frontend/build; index index.html index.htm; location ~ .(static)/(js|css|media)/(.+)$ { try_files $uri $uri/ /$1/$2/$3; } location / { try_files $uri $uri/ /index.html; } } React Route에서 걸리는 경우 # 리엑트 라우터에서 경로로 잡히는 경우에는 라우터 안에서 전체 경로로 들어온것을 살펴보시고 수정하시면 됩니다....


#nginx #react #static

원문링크 : [Nginx] 리엑트 static 폴더 파일 처리