Digital Ocean + Django + Nginx - Error: "NOT FOUND - The requested resource was not found on this server."

I have set up my website on digital ocean. I’m using nginx. everything is working fine, but some urls (like are not being served and give error - “Not Found The requested resource was not found on this server.”

My configuration file is

upstream app_server {
    server unix:/home/gojainyatra/run/gunicorn.sock fail_timeout=0;

server {
    listen 80;

    keepalive_timeout 5;
    client_max_body_size 4G;

    access_log /home/gojainyatra/logs/nginx-access.log;
    error_log /home/gojainyatra/logs/nginx-error.log;

    location /static/ {
        alias /home/gojainyatra/staticfiles/;

    # checks for static file, if not found proxy to app
    location / {
        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;

please help, I’m new to development and don’t have much idea what is going wrong.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Django doesn’t serve files itself, you have to setup a location block in nginx for that like you did in /static.

location /dharamshala/ {
        alias /home/gojainyatra/whatever-your-folder-dharamshala-is/;