So lately i’ve been trying to get into python development, specifically for web application using Django; everyone says it’s amazing, I want to know what all the fuss it about !
I host this site and a couple others on my own dedicated server running DirectAdmin, and I wanted to setup a dev space for my (future) Python / Django projects. I went looking for a little step by step guide on how to install mod_wsgi in a directadmin environment, and to my surprise I couldn’t find one.
After a bit more research and a bit of trial and error, I present to you my own little guide on how to do so :)
Please note that I am doing this on a Centos 6 environment, and cannot guarantee that this will work on any other. Also, I use nano for my text editing needs, feel free to use vi if you prefer it.
download the latest source files from here.
cd /tmp wget http://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz tar xzvf mod_wsgi-3.4.tar.gz cd mod_wsgi-3.4
Next we are going to compile our file
./configure make make install
Note that I was getting errors when compiling and I had to install the python development tools for it to work (yum install python-devel)
Now you are going to want to open your apache config file and load the module
In that file, after all the other “LoadModule”, add the following line
LoadModule wsgi_module /usr/lib/apache/mod_wsgi.so
(If you do not have a file called extra/httpd-phpmodules.conf, you will need to add this to “/etc/httpd/conf/httpd.conf”)
Now all we’ve got left to do is recompile apache with custombuild
(Only do the following command if you’ve never added custom modules to apache in the past, otherwise you WILL overwrite your existing modifications)
mkdir -p custom/ap2 cp configure/ap2/configure.apache custom/ap2/configure.apache
Now you will need to open …
And append this to the end of the file
See all the ” \ ” characters at the end of each line? You should make sure that all but the last line has one. Otherwise apache will not compile. You should end up with something along those lines:
"--enable-ssl" \ "--enable-rewrite" \ "--enable-proxy" \ "--enable-expires" \ "--enable-reqtimeout" \ "--with-ssl=/usr" \ "--enable-headers" \ "--with-mod_wsgi"
./build clean ./build apache
And here you have it, mod_wsgi is loaded on to apache !
Let me know if you are having any issues with this :)