我正在尝试在静态html网站上部署Django应用程序。将军www.example.com
将提供基本网站。然后,URI /app
应该代理到Gunicorn WSGI服务器。 sites-enabled
中的nginx配置如下所示:
upstream gunicorn {
server 127.0.0.1:8000;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/website;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
location /app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://gunicorn;
}
}
尝试www.example.com/app
时收到404错误。似乎URI以某种方式搞砸了。创建的完整网址为http://www.example.com/accounts/login/?next=/app/
完全按照本教程http://hackedexistence.com/project/raspi/django-on-raspberry-pi.html设置应用程序确实有效。
我的目标设定是否可能?如果是的话,我对位置概念的误解在哪里?
答案 0 :(得分:1)