Z
Z
zigen2016-01-19 17:02:11
Django
zigen, 2016-01-19 17:02:11

Why is nginx returning a 405 error?

Good afternoon.
Deployed a Django site using gunicorn+superviror+nginx.
The site took off - everything is ok.
In the admin panel, I add news with a picture - 405 arrives. post is not allowed.
site config:

upstream app_server {

  server unix:/tmp/PMC.sock fail_timeout=0;
}

server {

    listen   80;
    server_name site.ru;

    access_log /home/venv/PMC/logs/nginx-access.log main;
    error_log /home/venv/PMC/logs/nginx-error.log debug;

    location /static/ {
        alias   /home/venv/PMC/static/;
        access_log off;
    }

    location /media/ {
        alias   /home/venv/PMC/media/;
        access_log off;
    }

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        if (!-f $request_filename) {
            proxy_pass http://app_server;
            break;
        }
    }
}

I understand that nginx does not allow Post to static.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question