Trac/Apache 显示脚本内容(WSGI)

Trac/Apache 显示脚本内容(WSGI)

我正在努力安装新的 Trac 1.0.3(从源代码安装后遇到同样的问题easy_install)。

  • Debian 7.8
  • Apache 2.2.22
  • Python 2.7.3
  • 元始 0.6
  • SQLite 3.7.13
  • WSGI 3.3

我在中创建了 Trac 环境/var/trac/var/trac/cgi-bin保留了trac.wsgi。我已更新 Apache...LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so和我的站点的配置...

WSGIScriptAlias /trac /var/trac/cgi-bin/trac.wsgi

<Directory /var/trac/cgi-bin>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
</Directory>

<Location /trac>
    Order deny,allow
    Allow from all
</Location>

我的/var/trac/log/trac.log(为空)配置在trac.ini...

[logging]
log_file = /var/trac/log/trac.log
log_level = DEBUG
log_type = file

我的 Apache 错误日志...

[Thu Jan 29 18:38:46 2015] [debug] util_ldap.c(1990): LDAP merging Shared Cache conf: shm=0x7f4d8661f0f0 rmm=0x7f4d8661f148 for VHOST: hostname.example.net
[Thu Jan 29 18:38:46 2015] [info] APR LDAP: Built with OpenLDAP LDAP SDK
[Thu Jan 29 18:38:46 2015] [info] LDAP: SSL support available
[Thu Jan 29 18:38:46 2015] [debug] mod_wsgi.c(10080): mod_wsgi (pid=12945): Socket for 'My-WSGIDaemonProcess' is '/var/run/apache2/wsgi.12945.0.1.sock'.
[Thu Jan 29 18:38:46 2015] [notice] Apache/2.2.22 (Debian) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
[Thu Jan 29 18:38:46 2015] [info] mod_wsgi (pid=12951): Starting process 'My-WSGIDaemonProcess' with uid=33, gid=33 and threads=15.
[Thu Jan 29 18:38:46 2015] [info] mod_wsgi (pid=12951): Initializing Python.
[Thu Jan 29 18:38:46 2015] [info] Server built: Dec 23 2014 22:48:32
[Thu Jan 29 18:38:46 2015] [debug] worker.c(1757): AcceptMutex: sysvsem (default: sysvsem)
[Thu Jan 29 18:38:46 2015] [info] mod_wsgi (pid=12952): Initializing Python.
[Thu Jan 29 18:38:46 2015] [info] mod_wsgi (pid=12953): Initializing Python.
[Thu Jan 29 18:38:46 2015] [info] mod_wsgi (pid=12952): Attach interpreter ''.
[Thu Jan 29 18:38:46 2015] [info] mod_wsgi (pid=12951): Attach interpreter ''.
[Thu Jan 29 18:38:46 2015] [info] mod_wsgi (pid=12953): Attach interpreter ''.

Apache 访问日志中的浏览器请求...

1.2.3.4 - - [29/Jan/2015:18:44:20 -0500] "GET /trac HTTP/1.1" 304 188 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:35.0) Gecko/20100101 Firefox/35.0"

问题:Apache 正在服务于内容...我看到了/var/trac/cgi-bin/trac.wsgiPython 代码。

我不知道我哪里做错了,但非常感谢您的帮助。谢谢。

更新 1:如您所见,以上信息围绕着发出请求GET /trac。我发现发出GET /trac/login请求会导致 Apache 抛出一个HTTP 500

更新2:我禁用了错误配置的 LDAP 身份验证,现在HTTP 500出现错误。UPDATE 1HTTP 404

答案1

在您的 cgi-bin 指令中,尝试添加“ExecCGI”选项并添加 cgi-script 处理程序:

<Directory /var/trac/cgi-bin>
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
    Options ExecCGI
    SetHandler cgi-script
</Directory>

答案2

解决了我的问题...

Apache 配置...

WSGIScriptAlias / /var/trac/cgi-bin/trac.wsgi

<Directory /var/trac/cgi-bin>
    AllowOverride None
    WSGIApplicationGroup %{GLOBAL}
    Order deny,allow
    Allow from all
    Options ExecCGI
</Directory>

将此配置与问题中发布的配置进行比较。

相关内容