I am new to Django/Python/ mod_wsgi, and I was wondering if I could optimize this file to reduce memory usage:
ServerRoot "/home/<foo>/webapps/django_wsgi/apache2"
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule wsgi_module modules/mod_wsgi.so
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /home/<foo>/logs/user/access_django_wsgi.log combined
ErrorLog /home/<foo>/logs/user/error_django_wsgi.log
KeepAlive Off
Listen 12345
MaxSpareThreads 3
MinSpareThreads 1
MaxClients 5
MaxRequestsPerChild 300
ServerLimit 4
HostnameLookups Off
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIDaemonProcess django_wsgi processes=5 python-path=/home/<foo>/webapps/django_wsgi:/home/<foo>/webapps/django_wsgi/lib/python2.6 threads=1
WSGIPythonPath /home/<foo>/webapps/django_wsgi:/home/<foo>/webapps/django_wsgi/lib/python2.6
WSGIScriptAlias /auctions /home/<foo>/webapps/django_wsgi/auctions.wsgi
WSGIScriptAlias /achievers /home/<foo>/webapps/django_wsgi/achievers.wsgi
Although you have defined WSGIDaemonProcess directive to create a separate daemon process group, you aren't actually using it. If it is your intention to use daemon mode, you should delete WSGIPythonPath and add instead:
Also, if you are going to use daemon mode and the only thing occurring in main Apache processes is serving static files, you can change ThreadsPerChild back to:
as there is no need to be recycling the Apache server child processes on a periodic basis.
BTW, it is bad practice to throw away the complete default Apache configuration and then add in just what you think is needed. This is because you are throwing away all the default access security meaning that technically every file on your system can be served up if there is a URL mapping which exists that allows one to get to the file.