Ubuntu lighttpd安装和配置

系统 Linux
Ubuntu lighttpd修改配置文件查找"#### CGI module"在这行之后添加cgi.assign = ( ".sh" => "" )然后我们再写一个shell脚本来作测试 test.sh.

Ubuntu lighttpd已被广泛应用但是也在不断的更新,这里介绍Ubuntu lighttpd安装设置使用,帮助大家安装更新Ubuntu lighttpd系统。

一、关于测试环境

Ubuntu 5.10 , gcc4.0.2 , php5.1.1 , Ubuntu lighttpd 1.4.10如果要测试FASTCGI在编译PHP时需要打开fastcgi的选项( --enable-fastcgi)

二、下载相关软件

Ubuntu lighttpd http://www. lighttpd.net/download/php http://www.php.net

三、安装和配置

1、安装Ubuntu lighttpd

  1. root@tonyvicky:# tar vxzf Ubuntu lighttpd-1.4.10.tar.gz  
  2. root@tonyvicky:# cd Ubuntu lighttpd-1.4.10  
  3. root@tonyvicky:# ./configure --prefix=/usr/local/Ubuntu lighttpd  
  4. root@tonyvicky:# make  
  5. root@tonyvicky:# make install  
  6. root@tonyvicky:# mkdir /usr/local/Ubuntu lighttpd/htdocs  
  7. root@tonyvicky:# mkdir /usr/local/Ubuntu lighttpd/etc  
  8. root@tonyvicky:# cp ./doc/Ubuntu lighttpd.conf /usr/local/Ubuntu lighttpd/etc/ 

2、配置Ubuntu lighttpd

然后修改配置文件 /usr/local/ lighttpd/etc/ lighttpd.conf把"mod_fastcgi"前边的#去掉(在24行);把"mod_cgi"前边的#去掉(在29行)设置网站根目录 server.document-root = "/usr/local/ lighttpd/htdocs/" (40行)设置错误日志文件路径 server.errorlog = "/usr/local/ lighttpd/ lighttpd.error.log" (43行)设置访问日志文件路径accesslog.filename = "/usr/local/ lighttpd/access.log" (116行)启动服务器

  1. root@tonyvicky:# cd /usr/local/Ubuntu lighttpd/sbin/  
  2. root@tonyvicky:# ./Ubuntu lighttpd -f ../etc/Ubuntu lighttpd.conf 

如果出现错误请把配置文件中如下内容删除

  1. $HTTP["url"] =~ "\.pdf$" {  
  2. server.range-requests = "disable" 

3、配置CGI

修改配置文件查找"#### CGI module"在这行之后添加cgi.assign = ( ".sh" => "" )然后我们再写一个shell脚本来作测试 test.sh

  1. #!/bin/bash  
  2. echo "Content-Type: text/html";  
  3. echo "";  
  4. echo "test"; 

把这个文件保存到/usr/local/ lighttpd/htdocs/下并改变权限root@tonyvicky:# chmod a+x test.sh然后用浏览器访问一下 http://localhost/test.sh如果能出现"test"的字样,就说明CGI模块正常使用了.

4、配置fastcgi

修改配置文件查找"#### fastcgi module"在这行之后添加

  1. fastcgi.server = ( ".php" => 
  2. (( "socket" => "/tmp/php.socket",  
  3. "bin-path" => "/usr/local/php/bin/php",  
  4. "min-procs" => 1,  
  5. "max-procs" => 32,  
  6. "max-load-per-proc" => 4,  
  7. "idle-timeout" => 20  
  8. ))  

写一个PHP文件,看看能不能解析出来

  1. <? 
  2. // test.php  
  3. phpinfo();  
  4. ?> 

用浏览器访问一下 http://localhost/test.php

【编辑推荐】

  1. Ubuntu lighttpd安装解压缩运行代码
  2. Ubuntu PHP测试环境中调试和分析代码
  3. Ubuntu Ruby在Rails应用程序中解决内存泄漏问题
  4. Ubuntu ruby解析器应用程序的优化
  5. Ubuntu ror性能优化经验与应用的部署
责任编辑:佚名 来源: CSDN
相关推荐

2022-09-01 08:37:50

Ubuntu发行版

2010-03-05 09:50:37

Ubuntu ligh

2010-01-14 14:32:07

CentOS ligh

2011-03-29 10:22:33

2010-02-22 14:53:49

Ubuntu ngin

2015-09-30 14:04:36

KVMUbuntuLinux

2019-10-21 13:28:38

UbuntuPostgreSQL命令

2010-01-15 20:59:54

2011-05-24 09:33:40

UbuntuOpenStackNova

2020-03-18 14:40:14

Ubuntu 18.0RedisLinux

2011-03-11 16:42:38

Ubuntu安装LAMP

2011-03-23 09:07:48

2015-09-22 11:01:01

Plank DockUbuntuLinux

2022-09-14 11:31:37

MySQL数据库管理系统

2010-01-07 16:47:01

2009-12-31 09:25:40

Ubuntu ecli

2010-01-07 15:29:58

Ubuntu nfs

2009-12-31 14:27:22

UBUNTU Orac

2009-07-09 15:58:40

Ubuntu JDK安

2010-01-07 16:34:08

Ubuntu apac
点赞
收藏

51CTO技术栈公众号