在 Mac OS X 上将 mod_wsgi 安装到 apache2 中?

Dar*_*zer 3 mac-osx mod-wsgi apache-2.2

我使用 Homebrew 来构建和安装 mod_wsgi:

$ brew install mod_wsgi
==> Downloading http://modwsgi.googlecode.com/files/mod_wsgi-3.2.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/mod_wsgi/3.2 --disable-debug --disabl
==> make install
==> Caveats
NOTE: "brew install -v mod_wsgi" will fail! You must install
in non-verbose mode for this to succeed. Patches to fix this
are welcome (and should be sent upstream too.)

* You must manually edit /etc/apache2/httpd.conf to load
  /usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so

* On 10.5, you must run Apache in 32-bit mode:
  http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSX
==> Summary
/usr/local/Cellar/mod_wsgi/3.2: 3 files, 344K, built in 18 seconds
$ 
Run Code Online (Sandbox Code Playgroud)

然后我将以下行添加到 /etc/apache2/httpd.conf:

LoadModule mod_wsgi_module /usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so
Run Code Online (Sandbox Code Playgroud)

然后我重新启动了 Apache(使用sudo apachectl restart)。但是当我加载http://localhost/时我得到“无法连接到服务器” ,并且我在 /private/var/log/apache2/error_log 中看到以下内容:

[Tue Jul 06 15:15:18 2010] [notice] caught SIGTERM, shutting down
Run Code Online (Sandbox Code Playgroud)

如果我注释掉 LoadModule 行并再次重新启动 Apache,它会继续工作。

如何按照 brew 安装说明的指示正确“手动编辑 /etc/apache2/httpd.conf 以加载 /usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so”?

(我运行的是 Mac OS X 10.6.4。)

更新:我按照http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSX 上的说明强制执行 32 位执行,但仍然有同样的问题。

Gra*_*ton 5

跑:

sudo apachectl -t
Run Code Online (Sandbox Code Playgroud)

你会清楚地看到你在配置中犯了错误。用:

LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so
Run Code Online (Sandbox Code Playgroud)

因为说明应该告诉你。即,使用“wsgi_module”而不是“mod_wsgi_module”。看:

http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide#Loading_Module_Into_Apache

如果 HomeBrew 告诉您否则他们的说明是错误的。