Ubuntu lighttpd安装和配置
时间:2014-12-14 23:06 来源:linux.it.net.cn 作者:IT
Ubuntu lighttpd修改配置文件查找"#### CGI module"在这行之后添加cgi.assign = ( ".sh" => "" )然后我们再写一个shell脚本来作测试 test.sh.
AD:
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
-
root@tonyvicky:# tar vxzf Ubuntu lighttpd-1.4.10.tar.gz
-
root@tonyvicky:# cd Ubuntu lighttpd-1.4.10
-
root@tonyvicky:# ./configure --prefix =/usr/local/Ubuntu lighttpd
-
root@tonyvicky:# make
-
root@tonyvicky:# make install
-
root@tonyvicky:# mkdir /usr/local/Ubuntu lighttpd/htdocs
-
root@tonyvicky:# mkdir /usr/local/Ubuntu lighttpd/etc
-
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行)启动服务器
-
root@tonyvicky:# cd /usr/local/Ubuntu lighttpd/sbin/
-
root@tonyvicky:# ./Ubuntu lighttpd -f ../etc/Ubuntu lighttpd.conf
如果出现错误请把配置文件中如下内容删除
-
$HTTP["url"] =~ "/.pdf$" {
-
server.range-requests = "disable"
-
}
3、配置CGI
修改配置文件查找"#### CGI module"在这行之后添加cgi.assign = ( ".sh" => "" )然后我们再写一个shell脚本来作测试 test.sh
-
#!/bin/bash
-
echo "Content-Type: text/html";
-
echo "";
-
echo "test";
把这个文件保存到/usr/local/ lighttpd/htdocs/下并改变权限root@tonyvicky:# chmod a+x test.sh然后用浏览器访问一下 http://localhost/test.sh如果能出现"test"的字样,就说明CGI模块正常使用了.
4、配置fastcgi
修改配置文件查找"#### fastcgi module"在这行之后添加
-
fastcgi.server = ( ".php" = >
-
(( "socket" = > "/tmp/php.socket",
-
"bin-path" = > "/usr/local/php/bin/php",
-
"min-procs" = > 1,
-
"max-procs" = > 32,
-
"max-load-per-proc" = > 4,
-
"idle-timeout" = > 20
-
))
-
)
写一个PHP文件,看看能不能解析出来
-
<?
-
// test.php
-
phpinfo();
-
?>
用浏览器访问一下 http://localhost/test.php
(责任编辑:IT)
Ubuntu lighttpd修改配置文件查找"#### CGI module"在这行之后添加cgi.assign = ( ".sh" => "" )然后我们再写一个shell脚本来作测试 test.sh. AD: 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
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行)启动服务器
如果出现错误请把配置文件中如下内容删除
3、配置CGI 修改配置文件查找"#### CGI module"在这行之后添加cgi.assign = ( ".sh" => "" )然后我们再写一个shell脚本来作测试 test.sh
把这个文件保存到/usr/local/ lighttpd/htdocs/下并改变权限root@tonyvicky:# chmod a+x test.sh然后用浏览器访问一下 http://localhost/test.sh如果能出现"test"的字样,就说明CGI模块正常使用了. 4、配置fastcgi 修改配置文件查找"#### fastcgi module"在这行之后添加
写一个PHP文件,看看能不能解析出来
用浏览器访问一下 http://localhost/test.php |