Size: 4168
Comment:
|
Size: 5432
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 142: | Line 142: |
* 直接运行`django.fcgi`{{{ ./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 }}} |
继续研究尝试 ::-- 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. Django 方式
- 参考:
[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
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.2.1. 结果
重启 apache 成功
Not Found The requested URL / was not found on this server.
1.3. 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
<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.3.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
2. 反馈