|트러블슈팅| Docker nginx 가 static file 못 가져올때

이상학·2021년 11월 6일
0

AWS

목록 보기
5/6

Error! open() (no such file or directory)
nginx가 static file을 serving 하지 못하고있다...

http block에 server블럭에

client --> nginx --> unix:socket --> uwsgi --> Django

client에서 http 요청을 nginx로 보내면

http request port 80
-----> /static/은 nginx에서 serving
------> ㅣ
------> 이 둘은 unix:socket --> uwsg로 pass
http request 나머지 ------> ㅣ

volumes container 상대경로 지정

./djecommerce 는 container의 /srv/docker-server 에 해당한다.

container에 /srv/docekr-server/

http 요청 port A으로 GET /static/css/font 이 들어오면
nginx 는 port A를 listen 하고 /static/을 /srv/docker-server/static_in_env/으로 바꿔준다

container에는 결국 GET /srv/docker-server/static_in_env/ 요청이 들어가게 되고
이는 상대경로이므로 docker를 실행하는 프로젝트를 참고할때

/srv/docker-server/static_in_env/
--->
./djecommerce/static_in_env/

로 변환되서 static file을 찾게된다.

profile
기억의 지배장

0개의 댓글