-
lighttpd+fastcgi环境出现500 -Internal Server Error30
配置参考http://quantumflash.blog.hexun.com/11021106_d.html
环境:
ubunut7.10
ruby 1.8.6
rails 2.0.2
lighttpd 1.4.19
gems 1.1.0
fcgi 2.4.0
(主要)安装步骤:
1、源码安装readline
2、源码安装ruby,ruby-zlib
3、源码安装rubygems
4、sudo gem install rails -y
5、sudo gem install fcgi
6、源码安装pcre
7、源码安装lighttpd
在configure时候: ./configure -prefix=/usr/local -with-pcre=/user/local --without-bzip2
8、安装mysql
开始的时候用源码安装的,发现直接解压以后就能用了,怕出错。就用sudo apt-get install mysql-server重新安装了一次。
9、sudo gem install mysql
10、创建一个项目,然后启动服务器script/server,
发现是启动的lighttpd服务器,并同时自动把/usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/configs/lighttpd.conf拷贝到了当前项目的config目录下面。
发现能打开默认的页面。以为安装成功了。
但是ctrl+c结束服务时候出现:
Couldn't find any pid file in '/u/apps/project/current/tmp/pids'
matching 'dispatch.[0-9]*.pid'
(also looked for process matching "/u/apps/project/current/public/dispatch.fcgi")
以为是版本的问题,没有特别注意,
然后,修改当前项目下config下的lighttpd.conf文件:# Default configuration file for the lighttpd web server # Start using ./script/server lighttpd server.bind = "200.155.123.13" #(修改过)服务器的IP地址 server.port = 80 #(修改过)改成80号端口 server.modules = ( "mod_rewrite", "mod_accesslog", "mod_fastcgi", "mod_compress", "mod_expire" ) server.error-handler-404 = "/dispatch.fcgi" server.pid-file = CWD + "/tmp/pids/lighttpd.pid" server.document-root = CWD + "/public/" server.errorlog = CWD + "/log/lighttpd.error.log" accesslog.filename = CWD + "/log/lighttpd.access.log" url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) compress.filetype = ( "text/plain", "text/html", "text/css", "text/javascript" ) compress.cache-dir = CWD + "/tmp/cache" expire.url = ( "/favicon.ico" => "access 3 days", "/images/" => "access 3 days", "/stylesheets/" => "access 3 days", "/javascripts/" => "access 3 days" ) # Change *-procs to 2 if you need to use Upload Progress or other tasks that # *need* to execute a second request while the first is still pending. fastcgi.server = ( ".fcgi" => ( "localhost" => ( "min-procs" => 10,#(修改过) "max-procs" => 10,#(修改过) "socket" => CWD + "/tmp/sockets/fcgi.socket", "bin-path" => CWD + "/public/dispatch.fcgi", "bin-environment" => ( "RAILS_ENV" => "production" )#修改过 ) ) ) mimetype.assign = ( ".css" => "text/css", ".gif" => "image/gif", ".htm" => "text/html", ".html" => "text/html", ".jpeg" => "image/jpeg", ".jpg" => "image/jpeg", ".js" => "text/javascript", ".png" => "image/png", ".swf" => "application/x-shockwave-flash", ".txt" => "text/plain" ) # Making sure file uploads above 64k always work when using IE or Safari # For more information, see http://trac.lighttpd.net/trac/ticket/360 #下面不知道是什么意思 $HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" { server.max-keep-alive-requests = 0 }
查了有关材料,发现可能原因:
1、没有分配fastcgi进程
2、lighttpd的数据库模式配置不当
请教如何分配fastcgi进程?怎么配置lighttpd的数据库模式配置?
在进程中:
8251 ? 00:00:00 ruby
8255 ? 00:00:00 lighttpd
8256 ? 00:00:01 dispatch.fcgi <defunct>
8257 ? 00:00:00 dispatch.fcgi <defunct>
8258 ? 00:00:00 dispatch.fcgi <defunct>
8259 ? 00:00:00 dispatch.fcgi <defunct>
8260 ? 00:00:00 dispatch.fcgi <defunct>
8261 ? 00:00:00 dispatch.fcgi <defunct>
8262 ? 00:00:00 dispatch.fcgi <defunct>
8263 ? 00:00:00 dispatch.fcgi <defunct>
8264 ? 00:00:00 dispatch.fcgi <defunct>
9554 ? 00:00:00 sshd
9556 ? 00:00:00 sshd
9557 pts/1 00:00:00 bash
9579 ? 00:00:01 dispatch.fcgi <defunct>
dispatch.fcgi和lighttpd都是存在的。
查看日志:
cat lighttpd.error.log2008-05-29 16:43:42: (log.c.75) server started 2008-05-29 16:44:26: (server.c.1361) [note] graceful shutdown started 2008-05-29 16:44:26: (server.c.1475) server stopped by UID = 0 PID = 0 2008-05-29 16:47:28: (log.c.75) server started 2008-05-29 16:48:16: (server.c.1361) [note] graceful shutdown started 2008-05-29 16:48:16: (server.c.1475) server stopped by UID = 0 PID = 0 2008-05-29 16:52:40: (log.c.75) server started 2008-05-29 16:52:44: (mod_fastcgi.c.1743) connect failed: Connection refused on unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 2008-05-29 16:52:44: (mod_fastcgi.c.2912) backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 2008-05-29 16:52:46: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 7077 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 2008-05-29 16:52:46: (mod_fastcgi.c.3234) child exited, pid: 7077 status: 1 2008-05-29 16:52:46: (mod_fastcgi.c.3281) response not received, request sent: 972 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 for /dispatch.fcgi , closing connection 2008-05-29 16:52:48: (mod_fastcgi.c.1743) connect failed: Connection refused on unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 2008-05-29 16:52:48: (mod_fastcgi.c.2912) backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 2008-05-29 16:52:50: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 7079 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 2008-05-29 16:52:50: (mod_fastcgi.c.3234) child exited, pid: 7079 status: 1 2008-05-29 16:52:50: (mod_fastcgi.c.3281) response not received, request sent: 887 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 for /dispatch.fcgi , closing connection 2008-05-29 16:52:51: (mod_fastcgi.c.1743) connect failed: Connection refused on unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 2008-05-29 16:52:51: (mod_fastcgi.c.2912) backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 2008-05-29 16:52:53: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 7081 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 2008-05-29 16:52:53: (mod_fastcgi.c.3281) response not received, request sent: 887 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 for /dispatch.fcgi , closing connection 2008-05-29 16:56:25: (mod_fastcgi.c.1743) connect failed: Connection refused on unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 2008-05-29 16:56:25: (mod_fastcgi.c.2912) backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 2008-05-29 16:56:26: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 7240 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 2008-05-29 16:56:26: (mod_fastcgi.c.3281) response not received, request sent: 893 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-0 for /dispatch.fcgi , closing connection 2008-05-29 17:21:19: (server.c.1361) [note] graceful shutdown started 2008-05-29 17:21:19: (server.c.1475) server stopped by UID = 0 PID = 0 2008-05-29 17:26:57: (log.c.75) server started 2008-05-29 17:27:09: (mod_fastcgi.c.1743) connect failed: Connection refused on unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-29 17:27:09: (mod_fastcgi.c.2912) backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 2008-05-29 17:27:12: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 7688 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-29 17:27:12: (mod_fastcgi.c.3281) response not received, request sent: 893 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 for /dispatch.fcgi , closing connection 2008-05-29 17:30:35: (server.c.1361) [note] graceful shutdown started 2008-05-29 17:30:35: (server.c.1475) server stopped by UID = 0 PID = 0 2008-05-29 17:50:43: (log.c.75) server started 2008-05-29 17:50:50: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 7853 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-29 17:50:50: (mod_fastcgi.c.3234) child exited, pid: 7853 status: 1 2008-05-29 17:50:50: (mod_fastcgi.c.3281) response not received, request sent: 893 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 for /dispatch.fcgi , closing connection 2008-05-29 17:50:51: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 7861 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-29 17:50:51: (mod_fastcgi.c.3234) child exited, pid: 7861 status: 1 2008-05-29 17:50:51: (mod_fastcgi.c.3281) response not received, request sent: 893 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 for /dispatch.fcgi , closing connection 2008-05-29 17:50:53: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 7865 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-29 17:50:53: (mod_fastcgi.c.3281) response not received, request sent: 893 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 for /dispatch.fcgi , closing connection 2008-05-29 17:51:11: (server.c.1361) [note] graceful shutdown started 2008-05-29 17:51:11: (server.c.1475) server stopped by UID = 0 PID = 0 2008-05-29 18:01:55: (log.c.75) server started 2008-05-29 18:01:59: (server.c.1166) logfiles cycled UID = 0 PID = 0 2008-05-30 06:52:54: (mod_fastcgi.c.1743) connect failed: Connection refused on unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-30 06:52:54: (mod_fastcgi.c.2912) backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 2008-05-30 06:52:54: (mod_fastcgi.c.2680) child signaled: 1 2008-05-30 06:52:55: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 9178 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-30 06:52:55: (mod_fastcgi.c.3281) response not received, request sent: 520 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 for /dispatch.fcgi , closing connection 2008-05-30 09:14:18: (mod_fastcgi.c.1743) connect failed: Connection refused on unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-30 09:14:18: (mod_fastcgi.c.2912) backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 2008-05-30 09:14:19: (mod_fastcgi.c.2471) unexpected end-of-file (perhaps the fastcgi process died): pid: 9578 socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 2008-05-30 09:14:19: (mod_fastcgi.c.3234) child exited, pid: 9578 status: 1 2008-05-30 09:14:19: (mod_fastcgi.c.3281) response not received, request sent: 629 on socket: unix:/home/dave/teenyu/tmp/sockets/fcgi.socket-9 for /dispatch.fcgi , closing connection
cat fastcgi.crash.log# Logfile created on Thu May 29 16:43:44 +0800 2008 by / [29/May/2008:16:43:44 :: 6226] starting [29/May/2008:16:44:26 :: 6226] asked to stop immediately [29/May/2008:16:44:26 :: 6226] stopping after explicit exit [29/May/2008:16:47:29 :: 6278] starting [29/May/2008:16:48:16 :: 6278] asked to stop immediately [29/May/2008:16:48:16 :: 6278] stopping after explicit exit
cat production.log
为空。
这里我把所有的细节都写出来了。希望能得到帮助,可能问题很简单,但是我真的不知道该怎么解决,还请问下lighttpd和fcgi之间工作的原理。谢谢。
问题补充:
谢谢mengwade的回答,你的方法我已经试过了。可是不管用。好像和robbin的配置有点区别。
项目路径是有的:server.document-root = CWD + "/public/"
我还不清楚为什么直接用ruby script/server 就能启动lighttpd服务。以前在red hat上没有这样弄过。2008年5月30日 10:13
2个答案 按时间排序 按投票排序
-
从问题描述来看,是dispatch进程已经死掉了,而lighttpd无法连接dispatch进程。可能你的dispatch进程根本就没有正常启动。实际上在你的配置文件里面也没有任何针对dispatch的配置。
Rails自带的启动lighttpd脚本是ruby编写的,他需要从环境变量里面读取很多配置信息,才能决定如何启动,那么如果有些信息没有的话,启动肯定会失败。建议你不要用Rails的启动脚本,改用lighttpd自己的配置和启动脚本。
虽然lighttpd没有自带ubuntu版本的的启动控制脚本,但是自己写一个很容易,我的博客上面就有2008年5月30日 12:15
-
需要在配置文件中指定项目路径的
1. $HTTP["host"] == "www.xxx.com" { 2. server.document-root = "/yourrails/public" 3. server.error-handler-404 = "/dispatch.fcgi" 4. fastcgi.server = (".fcgi" => 5. ("localhost" => 6. ("min-procs" => 10, 7. "max-procs" => 10, 8. "socket" => "/tmp/lighttpd/socket/rails.socket", 9. "bin-path" => "/yourrails/public/dispatch.fcgi", 10. "bin-environment" => ("RAILS_ENV" => "production") 11. ) 12. ) 13. ) 14. }
2008年5月30日 10:20
相关推荐
在安卓中创建 lighttpd+mysql+php的服务器_almp7.zip
"Openwrt里架设Lighttpd+PhP5+MYSQL环境标准教程" 本教程旨在指导读者在Openwrt系统中架设Lighttpd+PhP5+MYSQL环境,实现Web服务器搭建。以下是相关知识点的详细解释: 一、硬件准备 * 路由器:需要一台路由器,...
phpLight 2014 是网上首套LightTPD+PHP集成包,集成最新Lighttpd+PHP+MySQL+SQL-Front+Zend Guard Loader+XCache。纯绿色,安装后无需再配置。支持系统服务和非服务两种启动方式,自由切换。一次性安装无需再安装,...
【搭建lighttpd+cgi的代码包】 在Web服务器领域,lighttpd是一个轻量级且高效的HTTP服务器,因其低内存占用和高速度而受到欢迎。CGI(Common Gateway Interface)则是一种标准,允许Web服务器执行外部程序并返回...
这里我们关注的是"lighttpd+mysql+php"的集成安装,特别适用于轻量级服务器需求,例如开发或测试环境。这个压缩包文件集合包含了在CentOS7系统上成功安装和测试的所有组件,包括lighttpd(一个轻量级HTTP服务器)、...
在Windows上配置lighttpd与FastCGI,需要在lighttpd配置文件中启用fastcgi模块,并定义fastcgi.server部分,指定PHP处理器的位置和连接参数。 PHP5是广泛使用的服务器端脚本语言,尤其适合Web开发。在lighttpd和...
phpLight 2013 是网上首套LightTPD+PHP集成包, 集成最新Lighttpd+PHP+MySQL+SQL-Front+Zend Guard Loader+XCache。 纯绿色,安装后无需再配置。支持系统服务和非服务两种启动方式,自由切换。 一次性安装无需再安装...
LightTPD则是一款轻量级的Web服务器,适合资源有限但需要高性能服务的环境。这些服务器软件都支持PHP解析,可以运行PHP脚本,为用户提供动态内容。 PHP是一种广泛使用的服务器端脚本语言,特别适合Web开发。集成的...
var.server_root = "/home/caoft/lighttpd/lighttpd_websocket_fastcgi/http_server" var.state_dir = "/home/caoft/lighttpd/lighttpd_websocket_fastcgi/http_server" var.home_dir = "/home/caoft/lighttpd/...
我是用lighttpd+nginx+spawn-fcgi+fcgi-2.4.1搭建环境。使用C语言编写后台程序。goahead也可以用。apt install lighttpdapt install nginxapt install spawn-fcgitar -xjvf fcgi-2.4.1-SNAP-0910052249.tar.bz2cd ...
以下是对"lighttpd+php in android"这个主题的详细说明。 **Lighttpd** Lighttpd是一款开源、快速、低内存占用的HTTP服务器,特别适合资源有限的设备,如Android手机或平板电脑。它的设计目标是提供高效的服务,...
《lighttpd-1.4.30:轻量级Web服务器的配置与应用》 lighttpd是一款轻量级的Web服务器,以其高效的性能、低内存占用和丰富的功能而受到许多开发者的青睐。在本篇文章中,我们将深入探讨lighttpd-1.4.30版本的特性和...
该程序包集成最新的Apache+Nginx+LightTPD+PHP+MySQL+phpMyAdmin+Zend Optimizer+Zend Loader,一次性安装,无须配置即可使用,是非常方便、好用的PHP调试环境。该程序绿色小巧简易迷你仅有35M,有专门的控制面板。...
在本文中,我们将深入探讨如何在Ubuntu操作系统上配置Lighttpd服务器与Webpy框架的集成,利用FastCGI技术实现高效动态网页服务。首先,确保已经安装了必要的组件,包括Lighttpd服务器、Webpy框架以及FastCGI支持。 ...
"/etc/init.d/lighttpd start" 启动lighttpd 直接访问 127.0.0.1 访问WEB 同时会在使用工具生成两个菜单,一个查看 phpinfo, 一个查看 lighttpd状态, 网站根目录在/var/www/ 下,php.ini 在 /etc/目录下, lighttpd....
Vagrant-dokuwiki 是一个基于Vagrant的项目,旨在为用户提供一个快速且便捷的方式来搭建一个生产级别的DokuWiki环境。这个环境配置了Arch Linux作为基础操作系统,同时还集成了lighttpd作为Web服务器以及php-fpm来...
交叉编译最新版的lighttpd-1.4.55,配置与测试CGI与HTML.内含 lighttpd-1.4.55源码,移植教程,cgi测试代码,html测试代码.测试cgi时,浏览器中应该输入192.168.100.30/cgi-bin/xx.cgi .其中 192.168.100.30为开发板的ip
它支持多种功能,如FastCGI、SSI、URL重写、压缩输出等,适用于静态网页和动态内容的服务器环境。lighttpd-1.4.59是该软件的一个稳定版本,包含了多项性能优化和安全更新。 二、系统需求 lighttpd可运行于多种操作...
其1.4.39版本是lighttpd发展中的一个重要里程碑,为用户提供了一个稳定且功能强大的服务环境。本文将深入探讨lighttpd的特性、安装与配置,并结合1.4.39版的特点,解析其在实际应用中的优势。 一、lighttpd概述 ...
lighttpd-1.4.20.tar lighttpd-1.4.20.tar