在Lighttpd服務(wù)器中運行Django應(yīng)用的方法
lighttpd (http://www.djangoproject.com/r/lighttpd/) 是一個輕量級的Web服務(wù)器,通常被用來提供靜態(tài)頁面的訪問。 它天生支持FastCGI,因此除非你的站點需要一些Apache特有的特性,否則,lighttpd對于靜態(tài)和動態(tài)頁面來說都是理想的選擇。
確保 mod_fastcgi 在模塊列表中,它需要出現(xiàn)在 mod_rewrite 和 mod_access ,但是要在 mod_accesslog 之前。
將下面的內(nèi)容添加到你的lighttpd的配置文件中:
server.document-root = "/home/user/public_html" fastcgi.server = ( "/mysite.fcgi" => ( "main" => ( # Use host / port instead of socket for TCP fastcgi # "host" => "127.0.0.1", # "port" => 3033, "socket" => "/home/user/mysite.sock", "check-local" => "disable", ) ), ) alias.url = ( "/media/" => "/home/user/django/contrib/admin/media/", ) url.rewrite-once = ( "^(/media.*)$" => "$1", "^/favicon\.ico$" => "/media/favicon.ico", "^(/.*)$" => "/mysite.fcgi$1", )
在一個lighttpd進程中運行多個Django站點
lighttpd允許你使用條件配置來為每個站點分別提供設(shè)置。 為了支持FastCGI的多站點,只需要在FastCGI的配置文件中,為每個站點分別建立條件配置項:
# If the hostname is 'www.example1.com'... $HTTP["host"] == "www.example1.com" { server.document-root = "/foo/site1" fastcgi.server = ( ... ) ... } # If the hostname is 'www.example2.com'... $HTTP["host"] == "www.example2.com" { server.document-root = "/foo/site2" fastcgi.server = ( ... ) ... }
你也可以通過 fastcgi.server 中指定多個入口,在同一個站點上實現(xiàn)多個Django安裝。 請為每一個安裝指定一個FastCGI主機。
相關(guān)文章
Python數(shù)據(jù)結(jié)構(gòu)與算法之使用隊列解決小貓釣魚問題
這篇文章主要介紹了Python數(shù)據(jù)結(jié)構(gòu)與算法之使用隊列解決小貓釣魚問題,結(jié)合實例形式分析了Python使用隊列實現(xiàn)小貓釣魚游戲的算法操作技巧,代碼中備有較為詳盡的注釋便于讀者理解,需要的朋友可以參考下2017-12-12Tensorflow分類器項目自定義數(shù)據(jù)讀入的實現(xiàn)
這篇文章主要介紹了Tensorflow分類器項目自定義數(shù)據(jù)讀入的實現(xiàn),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2019-02-02