http://www.lsanotes.cn/install_lighttpd
用Lighttpd做图片服务器
一.安装lighttpd所需的库文件
1.安装 pcrewgettar -zxvf pcre-8.10.tar.gzcd pcre-8.10./configuremakemake install
2.安装zlib
wgettar -zxvf zlib-1.2.5.tar.gzcd zlib-1.2.5./configuremakemake install
3.安装bzip2
wgetcd bzip2-1.0.5makemake install
二.安装lighttpd
1.下载lighttpdwget2.编译安装tar -zxvf lighttpd-1.4.28.tar.gzcd lighttpd-1.4.28groupadd lighttpduseradd –g lighttpd lighttpd./configure --prefix=/usr/local/lighttpdmakemake install
注意事项
如果make时出现类似以下错误/usr/local/lib/libbz2.a: could not read symbols: Bad value
则需要重新安装bzip2,修改bzip2的Makefile文件
vim MakefileCFLAGS=-Wall -Winline -O2 -g $(BIGFILES) #找到此行添加-fPIC,如下:CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) -fPIC
然后重新编译bzip和lighttpd
3.更改配置文件cp -r doc/config /usr/local/lighttpd/mkdir -p /var/log/lighttpdchown -R lighttpd.lighttpd /var/log/lighttpdmkdir –p /usr/www/htdocschown –R lighttpd.lighttpd /usr/www/htdocs
4.配置文件内容:
vim/usr/local/lighttpd/config/lighttpd.confvar.log_root = "/var/log/lighttpd"var.server_root = "/usr/www"var.state_dir = "/var/run"var.home_dir = "/usr/local/lighttpd/sbin/lighttpd"var.conf_dir = "/usr/local/lighttpd/config" var.vhosts_dir = server_root + "/vhosts"var.cache_dir = "/var/cache/lighttpd"var.socket_dir = home_dir + "/sockets" include "modules.conf"server.port = 80 server.username = "lighttpd"server.groupname = "lighttpd" server.document-root = server_root + "/htdocs"server.pid-file = state_dir + "/lighttpd.pid"server.errorlog = log_root + "/error.log" include "conf.d/access_log.conf"include "conf.d/debug.conf" server.event-handler = "linux-sysepoll"server.network-backend = "linux-sendfile"server.max-fds = 2048server.stat-cache-engine = "simple"server.max-connections = 1024 index-file.names += ( "index.xhtml", "index.html", "index.htm", "default.htm", "index.php") url.access-deny = ( "~", ".inc" ) $HTTP["url"] =~ "\.pdf$" { server.range-requests = "disable"} static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" ) include "conf.d/mime.conf"include "conf.d/dirlisting.conf"server.follow-symlink = "enable"server.upload-dirs = ( "/var/tmp" )
图片存放在/usr/www/htdocs下面,生成的图片是以/年/月/日的形式存放的
三.启动lighttpd
/usr/local/lighttpd/sbin/lighttpd -f /usr/local/lighttpd/config/lighttpd