當我查詢這個URL空 '當前URL' Django的部署Nginx的和FastCGI
http://mywebsite.com/foos/
Django的給我:
Page not found (404)
Request Method: GET
Request URL: http://mywebsite.com/foos//
The current URL, , didn't match any of these.
錯誤:
- 在請求URL就加我'/'結尾,
- 在當前URL中爲空。
我的規格:
我運行我的django網站與nginx作爲reverseproxy fast_cgi。
這裏nginx的我的網站的conf:
server {
listen 80;
server_name mywebsite.com;
location/{
fastcgi_pass unix:/tmp/_var_wwwdjango_mywebsite.socket;
include /etc/nginx/fastcgi_params;
}
}
這裏是我的fastcgi_params文件:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
#fastcgi_param HTTPS $server_https;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
備註:
如果我添加
url(r'^$', 'myapp.views.index')
到我的圖案化,使我我的所有請求的視圖...所以這顯然是一個nginx conf或fast_cgi問題。當我用django開發服務器執行我的網站時,我的網址沒問題。
請你可以更新你的問題,包括'/ etc/nginx/fastcgi_params' – Alasdair 2012-02-15 17:48:13
@Alasdair我加了它。 – 2012-02-15 18:13:35