gpt4 book ai didi

django - Css 不适用于 FastCGI 和 Lighttpd

转载 作者:行者123 更新时间:2023-12-01 06:42:33 25 4
gpt4 key购买 nike

我是 fastcgi 和 lighttpd 的新手,正在尝试设置我的 DJANGO 应用程序。目前面临几个问题:

  • CSS 根本不起作用
  • FastCGI 正在为请求的 URL 添加它的前缀,即
    mydomain.com/mysite.fcgi/mysite.fcgi/content/1/000228/而不是
    mydomain.com/content/1/000228/

  • 下面是我在 conf-enabled 文件夹中的 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" )

    任何的想法???

    最佳答案

    这是我的 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"

    关于django - Css 不适用于 FastCGI 和 Lighttpd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9049040/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com