Chinaunix首页 | 论坛 | 博客
  • 博客访问: 338893
  • 博文数量: 46
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 562
  • 用 户 组: 普通用户
  • 注册时间: 2013-05-14 13:32
个人简介

先知者为师

文章分类

全部博文(46)

文章存档

2016年(1)

2015年(6)

2014年(20)

2013年(19)

我的朋友

分类: Web开发

2016-03-02 21:42:12

安装环境ubuntu 15.10 LTS
安装lighttpd
    sudo apt-get install lighttpd
如有出现lighttpd: undefined symbol: FAMNoExists错误,请安装
    sudo apt-get install gamin

lighttpd配置文件请看廖雪峰的文章:配置文件在/etc/lighttpd/lighttpd.conf

如果出现错误 Cannot load plugin mod_fastcgi more than once, please fix your config
说明mod_fastcgi启用了多次,将/etc/lighttpd/lighttpd.conf里的启用mod_fastcgi禁用掉就行即
# "mod_fastcgi",
原因在这里
This is /usr/share/lighttpd/include-conf-enabled.pl

点击(此处)折叠或打开

  1. #!/usr/bin/perl -wl

  2. use strict;
  3. use File::Glob ':glob';

  4. my $confdir = shift || "/etc/lighttpd/";
  5. my $enabled = "conf-enabled/*.conf";

  6. chdir($confdir);
  7. my @files = bsd_glob($enabled);

  8. for my $file (@files)
  9. {
  10.         print "include \"$file\"";
  11. }
conf-enabled/*.conf 的配置文件里也启用了mod_fastcgi

app.py:代码

点击(此处)折叠或打开

  1. #! /usr/bin/env python
  2. import web
  3. urls = ('/','Index')

  4. app = web.application(urls,globals())

  5. class Index:
  6.     def GET(self):
  7.         return 'hello'

  8. if __name__ == "__main__":
  9.     app.run()
启用lighttpd
sudo lighttpd -D -f /etc/lighttpd/lighttpd.conf
-D的作用是将进程放到前台

如果出现child exited with: xxx 等错误
请将代码文件加上可执行权限,最好是chmod o+wrx app.py
因为默认lighttpd是以 www-data用户启用的
还有就是在第一行加入
#!/usr/bin/env python
否则也会造成这个错误,因为没解释器运行此脚本

阅读(1818) | 评论(0) | 转发(0) |
0

上一篇:wget https下载跳过 Enter PEM pass pharse

下一篇:没有了

给主人留下些什么吧!~~