这里是:
我使用fastcgi / nginx和django运行我的网站。我已经管理启动服务器,没有错误。 我运行了manage.py runserver并访问了该网站,它有一个在manage.py下工作的菜单但是当我使用manage.py runfcgi启动它时:
python manage.py runfcgi method=prefork maxchildren=30 host=127.0.0.1 port=4300 pidfile=pid workdir="$PWD" daemonize=false outlog="$LOGFILE" errlog="$LOGFILE"
该应用程序仅为我提供网站的第一页。
例如:
If I go to mywebsite.com this being the home page I get the right
template home.html.
If I visit mywebsite.com/get-started ,the server tries to render the same home.html.
使用manage.py runserver可以正常工作,但是使用runfcgi则不行。
PS: 该网站使用了一些cookie,它有一个自定义渲染功能,它是来自店面应用程序github的indextank服务:https://github.com/linkedin/indextank-service 您可以通过manage.py运行它。
当我尝试浏览顶部菜单时,通过runfcgi运行它并不会更改页面,它会发出请求,但它会出现在'home.html'的同一模板上
非常感谢任何想法。
补充: 服务器fastcgi配置非常标准:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
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 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 HTTPS $https if_not_empty;
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;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
和应用程序fastcgi配置:
server {
listen 80;
server_name search.spid.me www.search.spid.me;
client_max_body_size 1m;
location / {
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:4300;
include 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_pass 127.0.0.1:4300;
#fastcgi_param PATH_INFO $fastcgi_script_name;
#fastcgi_param REQUEST_METHOD $request_method;
#fastcgi_param QUERY_STRING $query_string;
#fastcgi_param SERVER_NAME $server_name;
#fastcgi_param SERVER_PORT $server_port;
#fastcgi_param SERVER_PROTOCOL $server_protocol;
#fastcgi_param CONTENT_TYPE $content_type;
#fastcgi_param CONTENT_LENGTH $content_length;
#fastcgi_pass_header Authorization;
#fastcgi_intercept_errors off;
}
location /_static {
expires 24h;
autoindex on;
alias /home/indextank/storefront/static/;
}
location /nginx_status {
stub_status on;
access_log off;
deny all;
allow 127.0.0.1;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
server_name spid.search.me www.spid.search.me;
listen 443;
ssl on;
#ssl_certificate /etc/nginx/conf.d/server.crt;
#ssl_certificate_key /etc/nginx/conf.d/server.key;
server_name search.spid.me www.search.spid.me;
client_max_body_size 1m;
location / {
fastcgi_pass 127.0.0.1:4300;
include fastcgi_params;
fastcgi_param HTTPS on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
我做了一些调试,结果发现请求的路径和path_info没有设置......
答案 0 :(得分:0)
发现问题。 我在fastcgi params文件中遗漏了一些fastcgi_params。 我添加了这些,似乎解决了这个问题。