最热门文章

常用标签

云输入法 好的站点 数据之美 数据库优化 网站优化 网页安全 跨浏览器 输入法 重构 页面优化 Android CSS css优化 facebook firebug HTML html重构 html5 HTTP协议 http历史 ie javascript Last Modified lighttpd linux linux后台开发 MYSQL mysql优化 netstat ping QQ QQ云输入法 QQWeb输入法 web web开发 Web服务器 web服务器配置 web设计 WEB颜色 xhtml

Posts Tagged ‘lighttpd安装配置’

web服务器lighttpd安装配置

lighttpd是一个优秀的静态文件服务器。基于epoll加多线程、插件模块很多,能力超强,我的vps默认使用的就是lighttpd,性能不错。 一 为什么要使用lighttpd apache不可以吗? 在支持纯静态的对象时,比如图片,文件等 , lighttpd速度更快,更理想 至于它和apache的比较,很多文档,大家可以google一下 二 从何处下载lighttpd http://www.lighttpd.net/download/这个是它的官方站 三 如何安装 1,编译安装 ./configure --prefix=/usr/local/lighttpd make make install configure完毕以后,会给出一个激活的模块和没有激活模块的清单,可以检查一下,是否自己需要的模块都已经激活,在enable的模块中一定要有“mod_rewrite”这一项,否则重新检查pcre是否安装。 2,编译后配置 cp doc/sysconfig.lighttpd /etc/sysconfig/lighttpd mkdir /etc/lighttpd cp doc/lighttpd.conf /etc/lighttpd/lighttpd.conf 如果你的Linux是RedHat/CentOS,那么: cp doc/rc.lighttpd.redhat /etc/init.d/lighttpd 如果你的Linux是SuSE,那么: cp doc/rc.lighttpd /etc/init.d/lighttpd 其他Linux发行版本可以自行参考该文件内容进行修改。 然后修改/etc/init.d/lighttpd,把 LIGHTTPD_BIN=/usr/sbin/lighttpd 改为 LIGHTTPD_BIN=/usr/local/lighttpd/sbin/lighttpd 此脚本用来控制lighttpd的启动关闭和重起: /etc/init.d/lighttpd start /etc/init.d/lighttpd stop /etc/init.d/lighttpd restart 四 配置 修改/etc/lighttpd/lighttpd.conf 1)server.modules 取消需要用到模块的注释,mod_rewrite,mod_access,mod_fastcgi,mod_simple_vhost,mod_cgi,      mod_compress,mod_accesslog, mod_expire是一般需要用到的。 其中"mod_expire"和"mod_compress"尤其重要,一个是设置页面素材的过期时间,一个是压缩页面素材;对于加速你的站点很有用处。 2)server.document-root, server.error-log,accesslog.filename需要指定相应的目录 server.document-root        = "/www/phc/html/" mkdir /usr/local/lighttpd/logs chmod 777 /usr/local/lighttpd/logs/ touch /usr/local/lighttpd/logs/error.log chmod 777 /usr/local/lighttpd/logs/error.log server.errorlog             = "/usr/local/lighttpd/logs/error.log" accesslog.filename             ...