Configure Wikipbx Mod Wsgi

These instructions make the following assumptions:

  • You are on Ubuntu/Debian
  • You are working with a newly installed Apache2 that has not yet been configured

Verify Apache2 is working

Modify Apache2 default Virtual Host

  • cd /etc/apache2/sites-available
  • vi default

Before

NameVirtualHost *
<VirtualHost *>

After

NameVirtualHost *:80
<VirtualHost *:80>

Create new Apache2 Virtual Host

  • cd /etc/apache2/sites-available
  • emacs wikipbx (NOTE: this will create a new file, and you can call it whatever you want)

Example file:

WSGIPythonPath /usr/src/wikipbx:/usr/src/django:/usr/src/freeswitch/libs/esl/python

<VirtualHost *:80>
    ServerAdmin webmaster@wikipbx.yourserver.net    
    WSGIScriptAlias / /usr/src/wikipbx/wikipbx.wsgi
    ServerName wikipbx.yourserver.net
    ErrorLog /var/log/apache2/wikipbx.yourserver.net-error.log
    CustomLog /var/log/apache2/wikipbx.yourserver.net.log common
    Alias /soundclips /usr/src/wikipbx/soundclips
    Alias  /site_media /usr/src/wikipbx/wikipbx/wikipbxweb/static
</VirtualHost>

Notes:

  • Replace yourserver.net with the domain name you plan on using.
  • WSGIPythonPath is important as it allows WikiPBX to find the core code and certain libraries it needs, such as Django and the Event Socket Library (ESL) it uses to communicate with freeswitch.
  • Adapt the paths in WSGIPythonPath to match your system
  • If you haven't installed freeswitch yet, you will have some non-existent (invalid) paths in WSGIPythonPath. That's OK for now, but make sure to come back and edit these paths to point to the correct places

Activate new Apache2 Virtual Host

  • cd /etc/apache2/sites-enabled
  • ln -s ../sites-available/wikipbx .
  • /etc/init.d/apache2 restart

Configure DNS or /etc/hosts file

/etc/hosts

vi /etc/hosts and add:

127.0.0.1       wikipbx.yourserver.net

dns

Talk to your DNS admin to have this domain added

Point browser to http://wikipbx.yourserver.net

At this point, you should see a 500 internal error in the browser. If you look at the error log (/var/log/apache2/wikipbx.yourserver.net-error.log), you will most likely see an error like:

ImproperlyConfigured: Error loading psycopg module: No module named psycopg

This means that there are missing dependencies that need to be installed.

Common Errors

Invalid command 'WSGIPythonPath'

If you get the error:

nvalid command 'WSGIPythonPath', perhaps misspelled or defined by a module not included in the server configuration

Apache is not loading the mod_wsgi module. See Install Mod Wgi

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License