文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>ubuntu+lighttpd+fcgi+php+rails

ubuntu+lighttpd+fcgi+php+rails

时间:2007-07-17  来源:stone5

上次搭好的环境,后面可以运行了。但一直都没有记下这个过程。再后来,发现lighttpd,在每天早上一些搜索引擎来抓一个exblog的网页时,经常让lighttpd当掉。现在已经重装了web服务器,又用回apache了,以下有些内容是凭记忆写的。


dddd
lighttpd虚拟主机的配置文件:

debian:/home/stone/web-bak/etc/lighttpd/conf-available# cat 11-simple-vhost.conf
## Simple name-based virtual hosting
##
## Documentation: /usr/share/doc/lighttpd-doc/simple-vhost.txt
## http://www.lighttpd.net/documentation/simple-vhost.html

server.modules += ( "mod_simple_vhost" )

## The document root of a virtual host isdocument-root =
## simple-vhost.server-root + $HTTP["host"] + simple-vhost.document-root
simple-vhost.server-root = "/var/www"
simple-vhost.document-root = "/public/"

## the default host if no host is sent
simple-vhost.default-host = "default.com"

$HTTP["host"] =="www.xx703.com"{
server.document-root = "/var/www/www.xx703.com/public"
url.rewrite = ( "^/$"=>"index.html","^([^.]+)$"=> "$1.html")
server.error-handler-404 = "/dispatch.fcgi"
fastcgi.server = ( ".fcgi" =>
 ("localhost"=>
  ("min-procs"=> 2,
   "max-procs"=> 2,
   "socket"=> "/tmp/wwwsm703com.fcgi.socket",
   "bin-path"=> "/var/www/www.xx703.com/public/dispatch.fcgi",
   "bin-environment"=> ( "RAILS_ENV" => "development")
  )
 )
)
}

$HTTP["host"]=~"noteme.net" {
server.document-root = "/var/www/note"
}

$HTTP["host"]=~"(www.sm114.cn|sm114.cn)" {
server.document-root = "/var/www/sm114"
}
$HTTP["host"]=~"(www.0598114.com|0598114.com)" {
server.document-root = "/var/www/sm114"
}
$HTTP["host"]=~"(^|\.)pk0598\.com" {
server.document-root = "/var/www/sm18900"
}
$HTTP["host"]=="db.sm114.cn" {
server.document-root = "/var/www/phpMyAdmin2902"
auth.require =("/"=>
                (
                "method"=>"basic",
                "realm"=>"need password",
                "require" => "user=stone"
                )
                )
}

lighttpd的fastcgi模块的配置文件:

debian:/home/stone/web-bak/etc/lighttpd/conf-available# cat 10-fastcgi.conf
## FastCGI programs have the same functionality as CGI programs,
## but are considerably faster through lower interpreter startup
## time and socketed communication
##
## Documentation: /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
## http://www.lighttpd.net/documentation/fastcgi.html

server.modules += ( "mod_fastcgi" )
打开下面这个选项可以调试用
#fastcgi.debug = 1

## Start an FastCGI server for php4 (needs the php4-cgi package)
fastcgi.server = (
# ".fcgi" => (
# "localhost" => (
# "min-procs" => 1,
# "max-procs" => 1,
# "socket" => "/tmp/rails.socket",
# "bin-path" => "/var/www/www.sm703.com/public/dispatch.fcgi",
# "bin-environment" => ( "RAILS_ENV" => "development" )
# )因为只有一个虚拟主机使用rails,所以这边我就注释了,改放到虚拟主机配置中
# ),
 ".php" => (
   "localhost" => (
      "bin-path" => "/usr/bin/php5-cgi",
      "socket" => "/tmp/php5-fcgi.socket"
    )
  )
)

 


发现原存在/images/目录下的图片都不能访问了,改成其它目录名就可以访问.不知何故,后将lighttpd.conf文件中如下一部分的那一行注释掉就行了:

$HTTP["host"] == "localhost" {
        global {
                alias.url += (
                        "/doc/" => "/usr/share/doc/",
# "/images/" => "/usr/share/images/"
                )
        }
        dir-listing.activate = "enable"
}

好像,须将使用rails的网站目录下的log目录要设成可写的。


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载