How to load mod_wsgi module in Apache

To install mod_wsgi, follow this link

After the installation of a module into “module” directory of Apache’s, we still need to load it into Apache’s configuration file.

Here are the steps

  1. Open Apache’s configuration file. You can find it in {root_directory_of_apache}/conf/ directory, with the name httpd.conf.
  2. Go to that place in the configuration file where other Apache’s modules are loaded.
  3. Add line
    LoadModule wsgi_module modules/mod_wsgi.so

    at the end of that section.

  4. Save the file.
  5. Restart Apache. Look here to how to do it.

If everything is alright, you’ll see the following line in {root_directory_of_apache}/logs/error_log file

Apache/2.4.23 (Unix) mod_wsgi/4.5.7 Python/2.7 configured

It is recommended that before proceeding you get a simple WSGI application running. Follow this link for that.

Note: Add a server name first for an ip in /etc/hosts.
Note: There some changes to be made in the code provided in the configuration link. Within both the directory tags, include the following

AllowOverride none
Require all granted

Leave a comment