Installing mod_wsgi into apache2 on Mac OS X

apache-2.2mac-osxmod-wsgi

I used Homebrew to build and install 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
$ 

I then added the following line to /etc/apache2/httpd.conf:

LoadModule mod_wsgi_module /usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so

And then I restarted Apache (with sudo apachectl restart). But then I get "can't connect to server" when I load http://localhost/, and I see the following in /private/var/log/apache2/error_log:

[Tue Jul 06 15:15:18 2010] [notice] caught SIGTERM, shutting down

If I comment out the LoadModule line and restart Apache again, it resumes working.

How do I properly "manually edit /etc/apache2/httpd.conf to load /usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so" as directed by the brew install note?

(I'm running Mac OS X 10.6.4.)

Update: I followed the instructions to force 32 bit execution at http://code.google.com/p/modwsgi/wiki/InstallationOnMacOSX, but still have the same problem.

Best Answer

Run:

sudo apachectl -t

and you will clearly see that you made an error in your configuration. Use:

LoadModule wsgi_module /usr/local/Cellar/mod_wsgi/3.2/libexec/mod_wsgi.so

as instructions should tell you. Ie., use 'wsgi_module' and not 'mod_wsgi_module'. See:

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

If HomeBrew is telling you otherwise their instructions are wrong.