今天在osx下安装了支援apache2(xampp套件)的fastcgi modules
参考 http://townx.org/ruby_on_rails_on_xampp_with_fastcgi_for_ubuntu_hoary
补个图:
具体安装步骤:
1.从 http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz 下载源码
2.解压, mv Makefile.AP2 Makefile
3.修改 top_dir 为 /Applications/xampp/xamppfiles
4.sudo make && make install
5.安装成功后在 mudoles下应该会有mod_fastcgi.so
6.新建fast-cgi的目录
cd /Applications/xampp/xamppfiles
mkdir fcgi
mkdir fcgi/dynamic
chown -R nobody fcgi
chmod -R 777 fcgi
7.修改 http.conf
加上
# Fastcgi
Include /Applications/xampp/etc/extra/httpd-fastcgi.conf
#在<ifMudole alias_module> 中加入
ScriptAlias /fcgi/ "/Applications/xampp/xamppfiles/fcgi/"
8.新建文件 /Applications/xampp/etc/extra/httpd-fastcgi.conf
LoadModule fastcgi_module modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiIpcDir /Applications/xampp/xamppfiles/fcgi
AddHandler fastcgi-script .fcgi
</IfModule>
<Directory "/Applications/xampp/xamppfiles/fcgi">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
9.新建文件 /Applications/xampp/xamppfiles/fcgi/test
#!/bin/sh
# disable filename globbing
set -f
echo "Content-type: text/plain; charset=iso-8859-1"
echo
echo CGI/1.0 test script report:
echo
echo argc is $#. argv is "$*".
echo
echo SERVER_SOFTWARE = $SERVER_SOFTWARE
echo SERVER_NAME = $SERVER_NAME
echo GATEWAY_INTERFACE = $GATEWAY_INTERFACE
echo SERVER_PROTOCOL = $SERVER_PROTOCOL
echo SERVER_PORT = $SERVER_PORT
echo REQUEST_METHOD = $REQUEST_METHOD
echo HTTP_ACCEPT = "$HTTP_ACCEPT"
echo PATH_INFO = "$PATH_INFO"
echo PATH_TRANSLATED = "$PATH_TRANSLATED"
echo SCRIPT_NAME = "$SCRIPT_NAME"
echo QUERY_STRING = "$QUERY_STRING"
echo REMOTE_HOST = $REMOTE_HOST
echo REMOTE_ADDR = $REMOTE_ADDR
echo REMOTE_USER = $REMOTE_USER
echo AUTH_TYPE = $AUTH_TYPE
echo CONTENT_TYPE = $CONTENT_TYPE
echo CONTENT_LENGTH = $CONTENT_LENGTH
10.启动apache,访问 http://localhost/fcgi/test 显示下面的结果就OK了~
引用
CGI/1.0 test script report:
argc is 0. argv is .
SERVER_SOFTWARE = Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8h DAV/2 mod_python/3.3.1 Python/2.5.1 PHP/5.2.6 mod_fastcgi/2.4.6
SERVER_NAME = localhost
GATEWAY_INTERFACE = CGI/1.1
SERVER_PROTOCOL = HTTP/1.1
SERVER_PORT = 80
REQUEST_METHOD = GET
HTTP_ACCEPT = text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
PATH_INFO =
PATH_TRANSLATED =
SCRIPT_NAME = /fcgi/test
QUERY_STRING =
REMOTE_HOST =
REMOTE_ADDR = ::1
REMOTE_USER =
AUTH_TYPE =
CONTENT_TYPE =
CONTENT_LENGTH =