Apache-2.2

Trac/Apache 顯示腳本內容 (WSGI)

  • January 30, 2015

我正在努力安裝新的 Trac 1.0.3(在通過 安裝相同的問題後從原始碼easy_install)。

  • Debian 7.8
  • 阿帕奇 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.wsgi……我看到了 Python 程式碼。

我不知道我哪裡出錯了,但您的幫助將不勝感激。謝謝。

***更新 1:***如您所見,上述資訊圍繞提出GET /trac請求。我發現雖然發出GET /trac/login請求會導致 Apache 拋出HTTP 500.

***更新 2:***我禁用了錯誤配置的 LDAP 身份驗證,並且現在HTTP 500錯誤.UPDATE 1``HTTP 404

解決了我的問題…

阿帕奇配置…

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>

將此配置與問題中發布的配置進行比較。

在您的 cgi-bin 指令中,嘗試添加“ExecCGI”選項並添加 cgi-script 處理程序:

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

引用自:https://serverfault.com/questions/663584