服务器环境:centos5.4 、lighttpd、django 框架
本地环境:winxp
1、将本地Host设置成自己要访问的域名。
例如: 21.32.32.43 www.baidu.com
2、设置lighttpd 配置文件
$HTTP['host'] =="www.baidu.com" {
server.document-root ="/home/baidu.com/"
server.error-handler-404 = "/404/"
fastcgi.server = (
"/fcgi"=>(
"main"=>(
"host" =>"127.0.0.1",
"port" => 3303,
"check-local"=>"disable"
)
),
)
alias.url +=(
)
}
启动lighttpd , lightttpd -f /etc/lighttpd/lighttpd.conf
到对应的目录,用fastcgi 运行 python 程序。
python manage.py runfcgi host=127.0.0.1 port=3303
这样你可以在本地浏览器中输入,www.baidu.com ,就可以看到自己的编写的程序执行结果了!!