nginx invalid number of arguments in “proxy_pass”

2019-03-01 06:39发布

nginx: [emerg] invalid number of arguments in "proxy_pass" directive in /etc/nginx/sites-enabled/django_direct:12

My nginx conf file:

server {
    listen 80;
    server_name 94.154.13.214;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /root/django_direct/main_app/;
    }

    location / {
        include proxy_params;
        proxy_pass unix: /root/django_direct/django_direct.sock;
    }
}

What do I do? UPD: I have changed file like this:

proxy_pass http://unix:/root/django_direct/django_direct.sock;

But didn't help, I've restarted nginx and now I am getting now a 502 Bad Gateway error.

标签: django nginx
2条回答
Anthone
2楼-- · 2019-03-01 07:20

Your argument is wrong. It needs an URL:

Sets the protocol and address of a proxied server and an optional URI to which a location should be mapped. As a protocol, “http” or “https” can be specified. The address can be specified as a domain name or IP address, and an optional port:

proxy_pass http://localhost:8000/uri/;

or as a UNIX-domain socket path specified after the word “unix” and enclosed in colons:

proxy_pass http://unix:/tmp/backend.socket:/uri/;

See the documentation: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass

查看更多
够拽才男人
3楼-- · 2019-03-01 07:20

Well the nginx sees two parameters: unix, and /root/django_redirect/.... I have the idea however that you want to specify a UNIX domain socket path. You can do this with:

proxy_pass http://unix:/root/django_direct/django_direct.sock;

As is described in the documentation.

查看更多
登录 后发表回答