继续研究尝试 ::-- ZoomQuiet [DateTime(2007-03-06T14:14:46Z)] TableOfContents
1. apache+fastcgi
1.1. 准备
- 因为需要将 SVN 通过 HTTP 进行发布,所以 Lighttpd 无法进行转移到 apache22
{{{#确保以下模块安装成功 LoadModule dav_module libexec/apache22/mod_dav.so LoadModule dav_svn_module libexec/apache22/mod_dav_svn.so LoadModule authz_svn_module libexec/apache22/mod_authz_svn.so
LoadModule python_module libexec/apache22/mod_python.so LoadModule fastcgi_module libexec/apache22/mod_fastcgi.so }}}
配置apache
<VirtualHost *:80> ServerName obp.zoomquiet.org DocumentRoot /path/to/web/site/root/htdocs <Directory "/path/to/web/site/root/htdocs"> Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> #Zoomq::070306 for SVN repos <Location /svn> DAV svn SVNParentPath /usr/local/repos # our access control policy AuthzSVNAccessFile /usr/local/repos/matter/conf/authz.cfg # try anonymous access first, resort to real # authentication if necessary. Satisfy Any Require valid-user # how to authenticate a user AuthType Basic AuthName "zoomquiet.org repository" AuthUserFile /usr/local/repos/svn.htpasswd SVNIndexXSLT "/svnindex.xsl" </Location> </VirtualHost>
1.2. 51boo方式
- 参考 [:ObpLatform/2007-02-24:limodou的配置]
完成 django.fsgi{{{#!/usr/local/bin/python
import sys, os sys.path = [, # Set the DJANGO_SETTINGS_MODULE environment variable. os.environ['DJANGO_SETTINGS_MODULE'] = "settings" from django.core.servers.fastcgi import runfastcgi runfastcgi(["method=threaded", "daemonize=false", "pidfile=pidfile"]) }}}
重启 apache 成功 直接运行django.fcgi
[http://www.djangoproject.com/documentation/fastcgi/ How to use Django with FastCGI] [http://nicholasdsj.blogspot.com/2006/12/django-apache2-fastcgi.html Django 学习笔记 - Apache2 + FastCGI] -- Nicholas @ Nirvana Studio 完成 obp.fcgi {{{#!/bin/bash # Replace these three settings. PROJDIR="/usr/local/www/data/obp/trunk/openbookplatform" PIDFILE="$PROJDIR/obp.pid" SOCKET="$PROJDIR/obp.sock" cd $PROJDIR if [ -f $PIDFILE ]; then kill cat -- $PIDFILE rm -f -- $PIDFILE fi exec /usr/bin/env - \ PYTHONPATH="../python:.." \ ./manage.py runfcgi socket=$SOCKET pidfile=$PIDFILE }}}
重启 apache 成功
尝试修订 obp.fcgi{{{#!/bin/sh # Replace these three settings. PROJDIR="/usr/local/www/data/obp/trunk/openbookplatform" PIDFILE="$PROJDIR/obp.pid" SOCKET="$PROJDIR/obp.sock" if [ -f $PIDFILE ]; then kill cat -- $PIDFILE rm -f -- $PIDFILE fi /usr/local/bin/python \ ./manage.py runfcgi socket=$SOCKET pidfile=$PIDFILE }}} ... zoomq python 51196 3 stream /usr/local/www/data/obp/trunk/openbookplatform/obp.sock zoomq python 51196 4 stream -> ?? zoomq python 51195 3 stream /usr/local/www/data/obp/trunk/openbookplatform/obp.sock zoomq python 51195 4 stream -> ?? zoomq python 51194 3 stream /usr/local/www/data/obp/trunk/openbookplatform/obp.sock zoomq python 51194 4 stream -> ?? zoomq python 51193 3 stream /usr/local/www/data/obp/trunk/openbookplatform/obp.sock zoomq python 51193 4 stream -> ?? zoomq python 51192 3 stream /usr/local/www/data/obp/trunk/openbookplatform/obp.sock zoomq python 51192 4 stream -> ?? zoomq python 51191 3 stream /usr/local/www/data/obp/trunk/openbookplatform/obp.sock }}} USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS zoomq python 50875 3 stream /home/zoomq/obp.sock zoomq python 50875 4 stream -> ?? zoomq python 50874 3 stream /home/zoomq/obp.sock zoomq python 50874 4 stream -> ?? zoomq python 50873 3 stream /home/zoomq/obp.sock zoomq python 50873 4 stream -> ?? zoomq python 50872 3 stream /home/zoomq/obp.sock zoomq python 50872 4 stream -> ?? zoomq python 50871 3 stream /home/zoomq/obp.sock zoomq python 50871 4 stream -> ?? zoomq python 50870 3 stream /home/zoomq/obp.sock }}} 修订apache 结果重启成功,访问 http://obp.zoomquiet.org/ 观察 rewrite.log
急了!!! lighttpd.conf 结果 ....
<VirtualHost *:80>
ServerName obp.zoomquiet.org
...
RewriteEngine On
#RewriteBase /
RewriteLogLevel 1
RewriteLog "/var/log/httpd/rewrite.log"
Alias /openbookplatform "/usr/local/www/data/obp/trunk/openbookplatform"
<Directory "/usr/local/www/data/obp/trunk/openbookplatform">
AddHandler fcgid-script .fcgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
</Directory>
1.2.1. 结果
Forbidden
You don't have permission to access /openbookplatform on this server.
./django.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Traceback (most recent call last):
File "/usr/local/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py", line 558, in run
protocolStatus, appStatus = self.server.handler(self)
File "/usr/local/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py", line 1112, in handler
result = self.application(environ, start_response)
File "/usr/local/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
response = self.get_response(request)
File "/usr/local/lib/python2.4/site-packages/django/core/handlers/base.py", line 59, in get_response
response = middleware_method(request)
File "/usr/local/lib/python2.4/site-packages/django/middleware/common.py", line 41, in process_request
if settings.APPEND_SLASH and (old_url[1][-1] != '/') and ('.' not in old_url[1].split('/')[-1]):
IndexError: string index out of range
Content-Type: text/html
1.3. Django 方式
FastCGIExternalServer /usr/local/www/data/obp/trunk/openbookplatform/obp.fcgi -host 127.0.0.1:3033
<VirtualHost *:80>
ServerName obp.zoomquiet.org
...
RewriteEngine On
#RewriteBase /
RewriteLogLevel 1
RewriteLog "/var/log/httpd/rewrite.log"
RewriteRule ^/(media.*)$ /usr/local/www/data/obp/trunk/openbookplatform/media/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ /obp.fcgi/$1 [QSA,L]
...
1.3.1. 结果
Not Found
The requested URL / was not found on this server.
1.4. 继续试探
FastCGIExternalServer /usr/local/www/data/obp/trunk/openbookplatform/obp.fcgi -socket /usr/local/www/data/obp/trunk/openbookplatform/obp.sock
<VirtualHost 210.192.102.145:80>
ServerName obp.zoomquiet.org
DocumentRoot /usr/local/www/data/obp/trunk/openbookplatform
...
Forbidden
You don't have permission to access / on this server
61.135.152.194 - - [06/Mar/2007:22:47:18 +0800] [obp.zoomquiet.org/sid#8148ce8][rid#82e1050/initial] (1) go-ahead with /usr/local/www/data/obp/trunk/openbookplatform/obp.fcgi/ [OK]
是成功的....2. lighttpd+fastcgi
### zoomq::070306 for fascgi pub Django
$HTTP["host"] == "obp.zoomquiet.org" {
server.document-root = "/usr/local/www/data/obp/trunk/openbookplatform"
fastcgi.server = (
"/obp.fcgi" => (
"main" => (
# Use host / port instead of socket for TCP fastcgi
# "host" => "127.0.0.1",
# "port" => 3033,
"socket" => "/usr/local/www/data/obp/trunk/openbookplatform/obp.sock",
"check-local" => "disable",
)
),
)
alias.url = (
"/site_media/" => "/usr/local/www/data/obp/trunk/openbookplatform/media/",
)
url.rewrite-once = (
"^(/site_media.*)$" => "$1",
"^/favicon\.ico$" => "/site_media/favicon.ico",
"^(/.*)$" => "/obp.fcgi$1",
)
}
2007-03-07 11:05:33: (mod_fastcgi.c.1690) connect failed: Socket operation on non-socket 0 /usr/local/www/data/obp/trunk/openbookplatform/obp.sock
2007-03-07 11:05:44: (mod_fastcgi.c.2682) fcgi-server re-enabled: 0 /usr/local/www/data/obp/trunk/openbookplatform/obp.sock
3. 反馈