linux lighttpd,在CentOS 7.6上使用lighttpd

2020-02-10 遇到的一点小问题

最近开始使用CentOS 7.6,继续之前在ArchLinux上使用的lighttpd。

yum install lighttpd

之前在ArchLinux安装lighttpd后,配置表只有这一些:

# This is a minimal example config

# See /usr/share/doc/lighttpd

# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions

server.port = 80

#server.username = "http"

#server.groupname = "http"

server.document-root = "/srv/http"

server.errorlog = "/var/log/lighttpd/error.log"

dir-listing.activate = "enable"

index-file.names = ( "index.html" )

mimetype.assign = (

".html" => "text/html",

".txt" => "text/plain",

".css" => "text/css",

".js" => "application/x-javascript",

".jpg" => "image/jpeg",x

".jpeg" => "image/jpeg",

".gif" => "image/gif",

".png" => "image/png",

"" => "application/octet-stream"

)

server.modules = ("mod_cgi")

cgi.assign = (".cgi" => "")

这次在CentOS上,要改的比较多。首先修改配置文件/etc/lighttpd/lighttpd.conf:

将原来的server.use-ipv6 = "enable"改成server.use-ipv6 = "disable",再执行systemctl start lighttpd后就能正常访问了。

578f70dca6e1

lighttpd

主要是通过.cgi文件来交互,所以还需要修改文件/etc/lighttpd/modules.conf:

将#include "conf.d/cgi.conf"前面的#号去掉,改成include "conf.d/cgi.conf"。

然后就是修改文件/etc/lighttpd/conf.d/cgi.conf。

文件里面原本定义了几个指定后缀文件的执行程序

cgi.assign = ( ".pl" => "/usr/bin/perl",

".cgi" => "/usr/bin/perl",

".rb" => "/usr/bin/ruby",

".erb" => "/usr/bin/eruby",

".py" => "/usr/bin/python" )

因为用不到,所以这个文件只保留了两句。

server.modules += ( "mod_cgi" )

cgi.assign = (".cgi" => "")

在/var/www/lighttpd/建了个wannoo.cgi,执行systemctl restart lighttpd后,试了一下,没想到一直返回500 Internal Server Error。把权限改成777,还是500 Internal Server Error。

找了半天原因,没想到最后竟然是Line Endings没设置好。改成Unix,可以了。

578f70dca6e1

Line Endings

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值