Lighttpd 配置FAQ

 

分类: LAMP - Lighttpd|Apahce|Nginx|PHP|MYSQL 747人阅读 评论(0) 收藏 举报
【Me FAQ】
Q1.(configfile.c.1081) base-docroot doesn't exist: /usr/local/www/data/?
Error Meaage:
无法启动 lighttpd 服务并出现如下错误讯息
# /usr/local/etc/rc.d/lighttpd start Starting lighttpd.
2006-09-25 17:20:51: (configfile.c.1081) base-docroot doesn't exist: /usr/local/www/data/
2006-09-25 17:20:51: (server.c.553) setting default values failed
Ans:
因为没这个目录 /usr/local/www/data 因此启动时出现错误
Q2.(mod_accesslog.c.514) opening access-log failed: Permission denied /var/log/lighttpd.access.log?
Error Meaage:
无法启动 lighttpd 服务并出现如下错误讯息
# /usr/local/etc/rc.d/lighttpd start Starting lighttpd.
2006-09-25 17:25:27: (mod_accesslog.c.514) opening access-log failed: Permission denied /var/log/lighttpd.access.log
2006-09-25 17:25:27: (server.c.834) Configuration of plugins failed. Going down.
Ans:
原因在于 lighttpd 预设并没有写入 /var/log 的权限,因此 log 檔事先建立否则启动服务将会因为 Log 檔无法建立而发生错误。
#touch lighttpd.access.log //建立 access log 檔
#touch lighttpd.error.log //建立 error log 檔
#chown www /var/log/lighttpd.* //改变 log owner
#chmod 666 /var/log/lighttpd.* //改变 log 权限
Q3.装了 lighttpd 及 php 后无法连 mysql?
Error Meaage:
装完 lighttpd 及 php 开启本来能连结 mysql 的 php 程序后却出现说无法连接 mysql
Call to undefined function: mysql_connect()
Ans:
我的问题则是跟上列论坛讨论的一样,就是先把 lighttpd 停掉,若此时 /tmp 内还有 FastCGI sockets 存在则删除掉,在重新启动 lighttpd 后就可顺利连结 MySQL 了
Q4.(network.c.159) socket failed: Protocol not supported?
Error Meaage:
无法启动 lighttpd 服务并出现如下错误讯息
#/usr/local/etc/rc.d/lighttpd start Starting lighttpd.
2007-04-25 10:11:33: (network.c.159) socket failed: Protocol not supported
Ans:
问题在于 lighttpd.conf 内有个选项是 Enable IPV6 但我的核心内已经把 options INET6 给 mark 掉,所以便出现说 Protocol not supported 解决方法就是去把 lighttpd.conf 内 Enable IPV6 选项给 mark 掉。
# Enable IPV6 and IPV4 together server.use-ipv6 = "enable"
//默认值 #server.use-ipv6 = "enable" //修改后
Q5.(network.c.300) can't bind to port: 0.0.0.0 80 Address already in use?
Error Meaage:
无法启动 lighttpd 服务并出现如下错误讯息
#/usr/local/etc/rc.d/lighttpd start Starting lighttpd.
2007-04-25 10:32:40: (network.c.300) can't bind to port: 0.0.0.0 80 Address already in use
Ans:
问题在于 lighttpd.conf 内有个选项是 0.0.0.0:80 ,解决方法就是去把 lighttpd.conf 内修改为该机器的 IP 即可。
# Enable IPV6 and IPV4 together $SERVER["socket"] == "0.0.0.0:80" { } //默认值 $SERVER["socket"] == "61.60.59.58:80" { } //修改后
Q6.点选 .cgi 变成下载窗口?
Error Meaage:
安装了 Nagios 后去读 .cgi 都变成下载 .cgi 档案的窗口
Ans:
因为还未开启 lighttpd 支持 CGI Module 导致,透过修改 lighttpd.conf 来支援 CGI Module
#vi /usr/local/etc/lighttpd.conf server.modules = ( "mod_cgi", //这行的 mark 要拿掉(支援 CGI Module) ) #### CGI module cgi.assign = ( ".pl" => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" )
若想确定 CGI Module 功能是否正确启动可写个简单的 test.cgi 来测试看看,修改后记得 chmod 755 test.cgi, test.cgi 内容如下
#!/usr/bin/perl print "Content-type: text/html/n/n"; print "<h1>hello world</h1>";
Q7.Unrecognized character /x7F at /home/web/nagios/cgi-bin/tac.cgi line 1.?
Error Meaage:
安装了 Nagios 后无法去读 .cgi 并都出现如下错误讯息
500 - Internal Server Error
而 lighttpd 的 error log 檔则说不认可该 cgi 的描述
# tail /var/log/lighttpd.error.log Unrecognized character /x7F at /home/web/nagios/cgi-bin/tac.cgi line 1.
Ans:
会造成这样的情况是因为 Nagios 的 cgi 不是 perl cgi 是 binary code 所以你用 perl 去处理它就造成 500 - Internal Server Error 做了如下修改后就可顺利读取 Nagios 的 cgi 了。
#### CGI module cgi.assign = ( ".pl" => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" ) //默认值(需要 perl 执行的 CGI) ".cgi" => "" ) //修改后(不需要特定解析程序就能执行的 CGI)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值