To set the image cache, so the images are transferred through nginx,
location /media/ { expires 7d; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; alias /home/djangoproject/media/; break; }
Some pictures on the server are missing, because after passing through nginx, it will be displayed
404 Not Found
nginx/1.4.6 (Ubuntu)
Improvement, first make a 404 forwarding page
add to the project url
urlpatterns = patterns('', ....... url(r'^404page$', 'home.views.error404', name='404page'), .......
add in views
def error404(request): return render(request, '404.html', locals())
Write a 404.html page in the templates directory
Django part OK
Then change nginx.conf
Add a line under server
error_page 404 = /404page;
It's ok,