【发布时间】:2016-06-19 01:20:28
【问题描述】:
我正在使用 1ClickInstallation 图像在 DigitalOcean 上运行 Django 站点。一切正常,但我遇到了 504 网关超时错误的问题。我在博客上尝试了多种设置,但无法正常工作。以下是我的设置:
upstream app_server {
server 127.0.0.1:9000 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /home/django/django_project;
index index.html index.htm;
client_max_body_size 4G;
server_name www.mydomain.com;
keepalive_timeout 5;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff2|woff|ttf)$ {
expires 365d;
}
# Your Django project's media files - amend as required
location /media {
alias /home/django/django_project/media/;
}
# your Django project's static files - amend as required
location static/static-only {
alias /home/django/django_project/static-only/;
}
# Django static images
location /static/django_project/images {
alias /home/django/django_project/static-only/django_project/images/;
}
# Proxy the static assests for the Django Admin panel
location /static/admin {
alias /usr/lib/python2.7/dist-packages/django/contrib/admin/static/admin;
}
location / {
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;
}
}
我在以下链接 http://nginx.org/en/docs/http/ngx_http_limit_req_module.html 上关注了文档
以下是“wget 127.0.0.1:9000”的结果
但不知道在哪里添加指令。好心提醒。
【问题讨论】:
-
网络服务器是否收到请求?静态文件的url是否正常?
-
当我打开我的主页时,它显示 504 Gateway Time-out nginx/1.4.6 (Ubuntu)
-
你可以试试:wget 127.0.0.1:9000 看看web服务器是否运行良好
-
我已经在主要问题中添加了快照......但它卡在等待响应......