Amazon EC2에서 내 장고 프로젝트를 호스팅하는 데 문제가 발생했습니다. (자바 스크립트 콘솔에서 발췌) 브라우저에서 내 페이지를로드하려고 할 때 사이트를 호스팅 Gunicorn와 Nginx에 사용 , 나는 오류를 다음 얻을 :HTTP 504 게이트웨이 Django (Nginx + Gunicorn)로 정적 파일을 제공 할 때 시간 만료
내가 Nginx에 내 정적 파일을 찾는 몇 가지 문제를 가지고 있다고 생각Failed to load resource: the server responded with a status of 504 (Gateway Time-out): https://example.com/favicon.ico
, 하지만 왜 그런지 모르겠습니다. 아무것도 표시되지 않습니다 /var/log/nginx/error.log
server {
listen 443 default;
client_max_body_size 100M;
server_name www.example.com;
keepalive_timeout 5;
ssl on;
ssl_certificate /etc/letsencrypt/live/www.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.example.com/privkey.pem;
# the domain name it will serve for
charset utf-8;
# path for static files
root /opt/app/staticfiles;
location /static {
root /opt/app/staticfiles;
}
location/{
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
/var/log/nginx/access.log 고양이 : 여기 내 Nginx에의 설정입니다.
HTTP 코드 504의 경우 일반적으로 긴 요청이 걸리고 결국 시간 초과되는 문제가 있지만 사이트를로드하려고하기 때문에 내 프로젝트에 어떻게 적용되는지 잘 모르겠습니다.
이 문제를 디버깅하는 방법을 모르는 경우 도움이 될 것입니다.