[英]nginx, flower, Django, proxy_pass, and rejecting invalid HOSTs
[英]nginx invalid number of arguments in "proxy_pass" directive
nginx: [emerg] invalid number of arguments in "proxy_pass" directive in /etc/nginx/sites-enabled/django_direct:12
我的 nginx 配置文件:
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;
}
}
我该怎么办? UPD:我已经改变了这样的文件:
proxy_pass http://unix:/root/django_direct/django_direct.sock;
但没有帮助,我已经重新启动了 nginx,现在我收到了 502 Bad Gateway 错误。
如果其他人发现了这个并出现了这个错误。 检查参数行末尾是否有分号。 适用于所有行,而不仅仅是 proxy_pass。
那么 nginx 看到两个参数: unix
和/root/django_redirect/...
。 但是,我有一个想法,您想指定一个 UNIX 域套接字路径。 你可以这样做:
proxy_pass http://unix:/root/django_direct/django_direct.sock;
如文档中所述。
你的论点是错误的。 它需要一个网址:
设置代理服务器的协议和地址以及位置应映射到的可选 URI。 作为协议,可以指定“http”或“https”。 地址可以指定为域名或 IP 地址,以及可选的端口:
proxy_pass http://localhost:8000/uri/ ;
或者作为在单词“unix”之后指定并用冒号括起来的 UNIX 域套接字路径:
proxy_pass http://unix:/tmp/backend.socket:/uri/ ;
请参阅文档: http : //nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
当您错误地输入=
字符并试图以这种方式分配值时,我也会发生这种情况。
proxy_pass = http://other_node;
同样的事情可能会发生在你身上,例如auth_basic = "restricted site"
。
只需删除=
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.