OK、FastCGI を使用して lighttpd で Django を実行しようとすると問題が発生します。こちらの手順に従いましたが、まだ機能せず、何が問題なのかわかりません。
で実行すると、django プロジェクトは機能しrunserver
ます。
だから、私はジャンゴを起動します:
python manage.py runfcgi socket=/var/run/django/django.sock pidfile=/var/run/django/django-fcgi.pid
lighttpd fastcgi 構成は次のようになります。
server.document-root = "/srv/www/lighttpd/"
fastcgi.server = (
"/django" => (
(
"socket" => "/var/run/django/django.sock",
"check-local" => "enable",
)
),
)
alias.url = (
"/static" => "/srv/www/lighttpd/static",
)
url.rewrite-once = (
"^(/static.*)$" => "$1",
"^(/.*)$" => "/django$1",
)
この構成では (または、「/django」を and の「.fcgi」または「/django.fcgi」に置き換えた場合) 、アクセスしようとすると常に 404 がfastcgi.server
返されます(ファイルは正常に動作します)。では、サーバーが FastCGI を試行していないようです。url.rewrite-once
/
/static
error.log
2011-02-24 16:18:00: (response.c.300) -- splitting Request-URI
2011-02-24 16:18:00: (response.c.301) Request-URI : /
2011-02-24 16:18:00: (response.c.302) URI-scheme : http
2011-02-24 16:18:00: (response.c.303) URI-authority: XXX.amazonaws.com
2011-02-24 16:18:00: (response.c.304) URI-path : /
2011-02-24 16:18:00: (response.c.305) URI-query :
2011-02-24 16:18:00: (response.c.300) -- splitting Request-URI
2011-02-24 16:18:00: (response.c.301) Request-URI : /d.fcgi/
2011-02-24 16:18:00: (response.c.302) URI-scheme : http
2011-02-24 16:18:00: (response.c.303) URI-authority: XXX.amazonaws.com
2011-02-24 16:18:00: (response.c.304) URI-path : /d.fcgi/
2011-02-24 16:18:00: (response.c.305) URI-query :
2011-02-24 16:18:00: (response.c.349) -- sanatising URI
2011-02-24 16:18:00: (response.c.350) URI-path : /d.fcgi/
2011-02-24 16:18:00: (mod_access.c.135) -- mod_access_uri_handler called
2011-02-24 16:18:00: (response.c.470) -- before doc_root
2011-02-24 16:18:00: (response.c.471) Doc-Root : /srv/www/lighttpd/
2011-02-24 16:18:00: (response.c.472) Rel-Path : /d.fcgi/
2011-02-24 16:18:00: (response.c.473) Path :
2011-02-24 16:18:00: (response.c.521) -- after doc_root
2011-02-24 16:18:00: (response.c.522) Doc-Root : /srv/www/lighttpd/
2011-02-24 16:18:00: (response.c.523) Rel-Path : /d.fcgi/
2011-02-24 16:18:00: (response.c.524) Path : /srv/www/lighttpd/d.fcgi/
2011-02-24 16:18:00: (response.c.541) -- logical -> physical
2011-02-24 16:18:00: (response.c.542) Doc-Root : /srv/www/lighttpd/
2011-02-24 16:18:00: (response.c.543) Rel-Path : /d.fcgi/
2011-02-24 16:18:00: (response.c.544) Path : /srv/www/lighttpd/d.fcgi/
2011-02-24 16:18:00: (response.c.561) -- handling physical path
2011-02-24 16:18:00: (response.c.562) Path : /srv/www/lighttpd/d.fcgi/
2011-02-24 16:18:00: (response.c.618) -- file not found
2011-02-24 16:18:00: (response.c.619) Path : /srv/www/lighttpd/d.fcgi/
fastcgi エントリを "/" に設定し、url.rewrite-once
セクションを省略した場合、django プロセスは呼び出されますが、渡される URI は常に "/" のように見えるため、"/static" 内のものに対するリクエストは、ルート ビュー。
これは、Fedora Core 8 を実行している Amazon EC2 上にあります。ディストリビューションの古いバージョンではなく、ソースから最新の lighttpd バージョンをインストールしました。