1

I installed Apache, Django, and mod_wsgi on Gentoo using emerge (on Amazon EC2).

I know that the mod_wsgi is configured in /etc/apache2/modules.d/70_mod_wsgi.conf:

<IfDefine WSGI>
LoadModule wsgi_module modules/mod_wsgi.so
</IfDefine>

# vim: ts=4 filetype=apache

So in my /etc/conf.d/apache I added the WSGI module:

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D WSGI"

But when I try to list the loaded module, mod_wsgi isn't listed.

root ~ # apache2 -M | grep wsgi
Syntax OK

I also know that mod_wsgi isn't loading properly because the Apache configuration file doesn't recognize WSGIScriptAlias.

By the way for Django to work I need to include a custom Apache configuration file. Where should I insert the line below?

Include "/var/www/localhost/htdocs/mysite/apache/apache_django_wsgi.conf"

I currently have that in the httpd.conf file but I feel like that file will get reseted whenever I upgrade Gentoo or related package.

EDIT: it seems the mod_wsgi file is located in /usr/lib64/apache2/modules/mod_wsgi.so.

Here is my detailed Apache settings:

root@ip-99-99-99-99 /usr/portage/eclass # apache2 -V
Server version: Apache/2.2.21 (Unix)
Server built:   Mar  7 2012 06:52:30
Server's Module Magic Number: 20051115:30
Server loaded:  APR 1.4.5, APR-Util 1.3.12
Compiled using: APR 1.4.5, APR-Util 1.3.12
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"
1
  • I also know that mod_wsgi isn't loading properly because the Apache configuration file doesn't recognize WSGIScriptAlias. --> where did you put this directive?
    – quanta
    Aug 17, 2012 at 8:07

1 Answer 1

0

If you include the line Include "/var/www/localhost/htdocs/mysite/apache/apache_django_wsgi.conf" in your vhost configuration file it will not be overriden with apache updates, if it is not your default vhost configuration file.

Or if you want to put it into the httpd.conf you should remember that after an apache update. Because if the httpd.conf from the gentoo package get's changed, you have to merge your httpd.conf with the new httpd.conf using either etc-update or dispatch-conf. And while doing that you have to say that you want to keep that line, and that should be all.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .