【发布时间】:2016-09-26 20:58:47
【问题描述】:
我有一个简单的 django 应用程序,我正试图在数字海洋上呕吐。我已将 NGINX 配置为代理我的端口并提供静态文件。但是,当我单击任何链接转到另一个页面时,它会在我身上显示 404。它只正确服务于索引页面,其他一切都是 404。
如果你们中的任何后端向导有任何其他我目前正在做/不做的事情,请随时在您的回复中添加这些内容。
我对 NGINX 很陌生,所以请把它说得更简单:) 谢谢。
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location /static {
alias /home/rchampin/ryan_the_developer_django/static;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
【问题讨论】:
标签: django postgresql nginx server digital-ocean