#少了一步安装 fcgi本身的
#将public下面的所有ruby路径改正确
#详细说明如何启用fcgi而不是cgi(改.htpaccess)
#将ruby-fcgi按README安装完全
#启用SYBASE要设置/etc/ld.so.conf加上sybase的lib路径(APACHE以NOBODY启动,LD_LIBRARY_PATH似乎没用)
1,为编译fastcgi,安装httpd-dev包
rpm -ivh httpd-dev***.rpm #会要求安装其它依赖包
2,构建mod_fastcgi.so,正常构建会报缺少文件(对fc4自动安装apache而言),会自动加入/usr/lib/httpd/module中,/etc/httpd/conf/httpd.conf也会自动加载(但语法不对)
apxs -n mod_fastcgi -i -a -c mod_fastcgi.c fcgi_buf.c fcgi_config.c fcgi_pm.c fcgi_protocol.c fcgi_util.c #在解压后的mod_fast2.4.2包中执行,构建mod_fast.so
chmod 755 /usr/lib/httpd/modules/mod_fastcgi.so #修改访问权限
3,ruby的fcgi模块正确安装方法
1,下载ruby-fcgi-0.8.7.tar.gz
2,ruby install.rb config -- --with-fcgi-include=/usr/local/include --with-fcgi-lib=/usr/local/lib (指向正确的fcgi安装路径)
3,其余按readme
4,为apache配置虚拟主机(客户机的host要配合指向)---还要加上一条时间选项
<Directory /var/www/>
AllowOverride all
</Directory>
LoadModule fastcgi_module modules/mod_fastcgi.so
FastCgiConfig -singleThreshold 100 -killInterval 300 -autoUpdate -idle-timeout 240 -pass-header HTTP_AUTHORIZATION
AddHandler fastcgi-script .fcgi
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/rails/testapp/public #testapp即为你rails程序的根目录
ServerName www.example.com
ErrorLog /var/log/httpd/testapp-error_log
CustomLog /var/log/httpd/testapp-access_log common
Options Indexes ExecCGI FollowSymLinks
RewriteEngine On
</VirtualHost>
6,启动apache,看欢迎页面
apachectl start #用这种方式可以在控制台查看错误消息(应该会报一条无效的加截so的行190?)
7,根据需要修改rails应用(producation环境,facgi的dispatch,数据库支持)
8,后续修改如下
chown -R apache.apache ${railsapp}
mkdir /tmp/fcgi_ipc
httpd.conf-->FastCgiIpcDir "/tmp/fcgi_ipc/"
chown -R apache.apache /tmp/fcgi_ipc
错误情况分析:
1,apache的error.log或app的error.log会报:(权限问题)
[Sun Nov 19 14:05:29 2006] [crit] (13)Permission denied:
FastCGI: can't create (dynamic) server "/var/www/rails/testapp/public/dispatch.fcgi":
bind() failed [/etc/httpd/logs/fastcgi/dynamic/3c713fbde3044b67e240a7bf3791f36b]
2,测试dispatch.fcgi的方法ruby -d dispatch.fcgi
3,app下面的fastcgi.crash.log中产生----注意,说方法丢失可能是c的动态库没有找到
Dispatcher failed to catch: undefined method `is_cgi?' for FCGI:Class (NoMethodError)
fcgi的问题
posted on 2007-08-10 11:46
liunix 阅读(959)
评论(0) 编辑 收藏