Nginx + Django + FastCGI WSGI 错误?(非致命)

dis*_*dng 3 nginx fastcgi django wsgi

我正在使用 fastcgi 在 nginx 之上运行 django。当我执行 runfcgi 时,我看到这些错误:

python manage.py runfcgi daemonize=false host=127.0.0.1 port=8000
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Run Code Online (Sandbox Code Playgroud)

在我的 nginx 错误日志中,我看到了这个:

2011/01/31 10:33:16 [error] 15921#0: *4 FastCGI sent in stderr: "WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!" while reading upstream, client: ::1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:8000", host: "localhost"
2011/01/31 10:38:35 [error] 15921#0: *6 FastCGI sent in stderr: "WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!" while reading upstream, client: ::1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:8000", host: 
Run Code Online (Sandbox Code Playgroud)

“本地主机”

一切正常,但只是我不希望我的错误日志充斥着这些信号。我已经在 apache 上看到了涉及使用 .htaccess 的解决方案(无论如何我认为这并不真正相关),但我还没有找到任何适用于 nginx 的解决方案。

alv*_*osu 7

添加到 nginx 位置:

fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;
Run Code Online (Sandbox Code Playgroud)