• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > 在Lighttpd服务器中运行Django应用的方法

在Lighttpd服务器中运行Django应用的方法

作者:goldensun 字体:[增加 减小] 来源:互联网

goldensun 通过本文主要向大家介绍了lighttpd,lighttpd 配置,lighttpd 安装,lighttpd源码分析,lighttpd windows等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

lighttpd (http://www.djangoproject.com/r/lighttpd/) 是一个轻量级的Web服务器,通常被用来提供静态页面的访问。 它天生支持FastCGI,因此除非你的站点需要一些Apache特有的特性,否则,lighttpd对于静态和动态页面来说都是理想的选择。

确保 mod_fastcgi 在模块列表中,它需要出现在 mod_rewrite 和 mod_access ,但是要在 mod_accesslog 之前。

将下面的内容添加到你的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",
)
</div>

在一个lighttpd进程中运行多个Django站点

lighttpd允许你使用条件配置来为每个站点分别提供设置。 为了支持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 = (
  ...
 )
 ...
}

</div>

你也可以通过 fastcgi.server 中指定多个入口,在同一个站点上实现多个Django安装。 请为每一个安装指定一个FastCGI主机。

 

</div>

您可能想查找下面的文章:

  • 在Lighttpd服务器中运行Django应用的方法
  • 在Lighttpd服务器中运行Django应用的方法

相关文章

  • Python生成随机数组的方法小结
  • 把MySQL表结构映射为Python中的对象的教程
  • 详解Python中的Descriptor描述符类
  • Python使用Socket(Https)Post登录百度的实现代码
  • 解读Python selenium的等待方式
  • Python 爬虫学习笔记之多线程爬虫
  • python通过pil模块获得图片exif信息的方法
  • python ip正则式
  • 举例介绍Python中的25个隐藏特性
  • Python3控制路由器——使用requests重启极路由.py

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • Python遍历目录中的所有文件的方法
    • 详解Python当中的字符串和编码
    • 理解生产者消费者模型及在Python编程中的运用实例
    • Python发送Email方法实例
    • wxpython中利用线程防止假死的实现方法
    • Python学习笔记_数据排序方法
    • Python import用法以及与from...import的区别
    • Python实现提取谷歌音乐搜索结果的方法
    • python多线程编程中的join函数使用心得
    • Python爬取qq music中的音乐url及批量下载

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有