I am getting "Invalid command 'WSGIScriptAlias' " error while starting Apache

Burak picture Burak · Mar 30, 2012 · Viewed 35.5k times · Source

I want to deploy my Django project to EC2 server. I installed mod_wsgi.

And made configuration like in the tutorial of django.

I am getting the following:

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

What is the reason? mod_wsgi is not installed correctly?

LoadModule wsgi_module     libexec/httpd/mod_wsgi.so
LoadModule alias_module    libexec/httpd/mod_alias.so


WSGIScriptAlias / /usr/local/apache2/htdocs/mysite/mysite/wsgi.py
WSGIPythonPath /usr/local/apache2/htdocs/mysite/mysite


<Directory /path/to/mysite.com/mysite>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>

Answer

om choudhary picture om choudhary · Sep 29, 2012

The problem is that mod_wsgi is not installed properly.

Solution (using Apache 2):

  1. install Apache:

    $ sudo apt-get install apache2
    
  2. install libapache2-mod-wsgi:

    $ sudo apt-get install libapache2-mod-wsgi
    

And this should work fine.