`
rikugun
  • 浏览: 345962 次
  • 性别: Icon_minigender_1
  • 来自: 南宁
社区版块
存档分类
最新评论

OS X下的lighttpd fastcgi python

阅读更多
昨天没有把Apaache2的fcgid搞定,今天试了试lighttpd + fastcgi +python
参考了蛮多的教程,小小总结一下

1.安装lighttpd 网上很多教程,不重复了
2.修改lighttpd.conf,主要改下面的
fastcgi.server = ( ".py"  =>
        ((  "socket"    =>  "/tmp/fastcgi.socket",
            "bin-path"  =>  "/Applications/xampp/xamppfiles/fcgi-bin/index.py",
            "max-procs" =>  10,
            "bin-environment"   =>  (
                "index.py"  =>  ""
                                    )
         ))
)
url.rewrite-once = (
        "^/favicon.ico$"    =>  "/static/favicon.ico",
        "^/static/(.*)$"    =>  "/static/$1",
		"^/media/(.*)$"    =>  "/media/$1",
        "^/(.*)$"           =>  "/index.py/$1"
)

3.安装python flup
easy_install flup就OK了
4.创建 /Applications/xampp/xamppfiles/fcgi-bin/index.py
#!/usr/bin/env python2.5
try:
    from flup.server.fcgi import WSGIServer

    def myapp(environ, start_response):
        start_response('200 OK', [('Content-Type', 'text/plain')])
        return ['Hello  World!\n']

    WSGIServer(myapp).run()

except Exception, e:
    print 'Content-Type: text/plain\r\n\r\n',
    print 'Oops...'
    print
    print 'Trac detected an internal error:'
    print
    print e
    print

5.参考robin的教程写一个启动的脚本
#!/bin/sh

case "$1" in 
  start)         
    /usr/local/lighttpd/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf 
    ;;
  stop) 
   killall lighttpd
    ;;
  restart) 
   $0 stop
   sleep 1
   $0 start 
   ;;
  *) 
  echo "Usage: lighttpd.sh {start|stop|restart}" 
  ;; 
esac

exit 0 

6.chmod +x lighttpd.sh
7.运行 lighttpd.sh start
8.访问 http://localhost/index.py
显示 Hello  World!
安装成功
分享到:
评论

相关推荐

    lighttpd fastcgi

    1.修改lighttpd.conf 修改为自己的工作目录 var.server_root = "/home/caoft/lighttpd/lighttpd_websocket_fastcgi/http_server" var.state_dir = "/home/caoft/lighttpd/lighttpd_websocket_fastcgi/http_server"...

    简明Windows,lighttpd,fastcgi,php5 Web服务器配置

    NULL 博文链接:https://yeahoo.iteye.com/blog/319066

    最新lighttpd源码 lighttpd-1.4.22

    支持FastCGI, CGI, Auth, 输出压缩(output compress), URL重写, Alias等重要功能,而Apache之所以流行,很大程度也是因为功能丰富,在lighttpd上很多功能都有相应的实现了,这点对于apache的用户是非常重要的,因为...

    LightTPD for windows 1.4.45-x64

    startLighttp.vbs 为一键启动lighttpd和php-cgi的启动脚本,php使用fastcgi host:port形式 test_cgi.cmd 为测试cgi传参数用(如果发现php程序返回No input file specified.说明server.document-root这个目录配置的有...

    ubuntu lighttpd实现websocket

    如何在ubuntu上实现lighttpd 1、下载mongoose使用mongoose中的example中的websocket_chat,实现websocket 2、websocket_chat源码下载路径 官网:https://cesanta.com 论坛:...

    lighttpd源码

    支持FastCGI,CGI,Auth,输出压缩(output compress),URL重写,Alias等重要功能;而Apache之所以流行,很大程度也是因为功能丰富,在lighttpd上很多功能都有相应的实现了,这点对于apache的用户是非常重要的,因为...

    Lighttpd源码分析_mobi

    主要内容包括:lighttpd介绍与分析准备工作、lighttpd网络服务主模型、lighttpd数据结构、伸展树、日志系统、文件状态缓存器、配置信息加载、i/o多路复用技术模型、插件链、网络请求服务响应流程、请求响应数据快速...

    LightTPD for windows 1.4.45-x86

    startLighttp.vbs 为一键启动lighttpd和php-cgi的启动脚本,php使用fastcgi host:port形式 test_cgi.cmd 为测试cgi传参数用(如果发现php程序返回No input file specified.说明server.document-root这个目录配置的有...

    lighttpd-1.4.20.tar

    lighttpd-1.4.20.tar lighttpd-1.4.20.tar

    Lighttpd源码分析

    资源名称:Lighttpd源码分析内容简介: 作为最为优秀的轻量级Web Server之一,Lighttpd有着众多的忠实拥护者和使用者。Lighttpd源码分析就是一本介绍分析Lighttpd源码的初级读本,其主要目标在于:一方面让已经接触...

    lighttpd 主工作模式

    lighttpd 流程分析工作模式,帮助理解lighttpd

    CentOS下Lighttpd Web服务器安装与配置方法

    OS: CentOS release 5.5 Lighttpd: 1.4.28 安装 sudo yum install lighttpd.i386 lighttpd-fastcgi.i386 lighttpd-mod_mysql_vhost.i386 运行 检查配置文件 lighttpd -t -f lighttpd.conf 启动lighttpd服务 ...

    varnish+lighttpd配置

    varnish+lighttpd配置

    lighttpd完全学习

    lighttpd完全学习,适合新手文档参考,ppt文件

    最新lighttpd-1.4.28源码下载

    最新lighttpd-1.4.28源码下载最新lighttpd-1.4.28源码下载最新lighttpd-1.4.28源码下载最新lighttpd-1.4.28源码下载最新lighttpd-1.4.28源码下载最新lighttpd-1.4.28源码下载

    lighttpd-1.4.45_lighttpd服务器_

    lighttpd轻量级web嵌入式服务器,方便嵌入式平台移植,小巧安全

    lighttpd-1.4.26 源码

    lighttpd-1.4.26 源码,官方直接下载,学习的好资源。

    lighttpd-1.4.20-cmake

    lighttpd-1.4.20-cmake

    lighttpd代码阅读资料

    lighttpd代码阅读资料 参数的 web服务器

    lighttpd配置和启动脚本

    包括lighttpd.conf配置文件以及用于控制web server启动和停止的脚本。

Global site tag (gtag.js) - Google Analytics