我是fastcgi和lighttpd的新手,并尝试设置我的DJANGO应用程序。目前面临几个问题:
CSS根本不工作
FastCGI正在为请求的URL添加其前缀,即
mydomain.com/mysite.fcgi/mysite.fcgi/content/1/000228/而不是
mydomain.com/content/1/000228 /
以下是我在启用conf的文件夹中的FastCGI脚本(10-fastcgi.conf):
# /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions#mod_
# fastcgi-fastcgi
server.modules += ( "mod_fastcgi" )
fastcgi.server = (
"/" => (
"main" => (
"socket" => "/tmp/mysite.sock",
"check-local" => "disable",
)
),
)
alias.url = (
"/media" => "/home/path/to/my/media",
)
url.rewrite-once = (
"(/media.*)$" => "$1",
"^/favicon\.ico$" => "/media/favicon.ico",
"^(/.*)$" => "/mysite.fcgi$1",
)
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png",
".css" => "text/css"
)
和我的lighttpd.conf配置:
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",)
server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
include "/etc/lighttpd/conf-enabled/10-fastcgi.conf"
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm",
" index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
dir-listing.encoding = "utf-8"
server.dir-listing = "enable"
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/x-javascript", "text/css", "text/html",
"text/plain" )
任何想法???
答案 0 :(得分:0)
这是我的conf的例子。 查看fastcgi.server值:
$HTTP["host"] == "example.com" {
server.document-root = "/var/django/example.com/mysite/"
fastcgi.server = (
"/mysite.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
# "host" => "127.0.0.1",
# "port" => 3033,
"socket" => "/var/django/example.com/mysite/mysite.sock",
"check-local" => "disable",
)
),
)
alias.url = (
"/media" => "/usr/lib/python2.7/site-packages/django/contrib/admin/media/",
"/favicon.ico" => "/var/django/example.com/mysite/static/img/favicon.ico",
)
url.rewrite-once = (
"^(/media.*)$" => "$1",
"^(/static.*)$" => "$1",
"^(/favicon.ico)$" => "$1",
"^(/.*)$" => "/mysite.fcgi$1",
)
accesslog.filename = "/var/log/lighttpd/example.com.log"