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

6,426 views
Skip to first unread message

tan3

unread,
Apr 28, 2011, 10:15:46 PM4/28/11
to modwsgi
Hi,


I installed apache2 and mod-wsgi in ubuntu. I even entered the config
details for WSGI in defualt of apache2

Alias /media/ /home/nagaraj/ghar/templates/media/

<Directory /home/nagaraj/ghar/templates/media>
Order deny,allow
Allow from all
</Directory>

WSGIScriptAlias / /home/nagaraj/ghar/apache/django.wsgi

<Directory /home/nagaraj/ghar/apache>
Order allow,deny
Allow from all
</Directory>

Which here is my Django project related path.

But i got an error saying
Syntax error on line 50 of /etc/apache2/sites-enabled/000-default:
Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a
module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.
...fail!

Can anyone tell, what is wrong here? Please

Graham Dumpleton

unread,
Apr 28, 2011, 10:48:40 PM4/28/11
to mod...@googlegroups.com
You are missing the line:

LoadModule wsgi_module modules/mod_wsgi.so

(modified as appropriate for your installation).

You don't say how you installed mod_wsgi, from source code or binary OS package.

If from source you need to add it by hand. If from a binary OS package
you generally use the OS supplied command to enable the Apache module.

How did you install mod_wsgi itself?

Graham

> --
> You received this message because you are subscribed to the Google Groups "modwsgi" group.
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to modwsgi+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
>
>

Message has been deleted

Graham Dumpleton

unread,
May 1, 2011, 7:28:03 PM5/1/11
to mod...@googlegroups.com
Your post came through lacking additional content. Did you intend
there to be anything in it?

Graham

On 1 May 2011 22:17, Nagaraj Tantri <nagara...@gmail.com> wrote:

> --
> Regards,
> Nagaraj Tantri
> (Cell : +919743232150)

tan3

unread,
May 1, 2011, 10:14:16 PM5/1/11
to modwsgi
Hello,


I installed it using "apt-get install libapache2-mod-wsgi " in ubuntu.
So need i still add the Load module command?

Thank you,

On May 2, 4:28 am, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> Your post came through lacking additional content. Did you intend
> there to be anything in it?
>
> Graham
>
> On 1 May 2011 22:17, Nagaraj Tantri <nagarajtan...@gmail.com> wrote:

Bo Daley

unread,
May 1, 2011, 10:18:20 PM5/1/11
to mod...@googlegroups.com
in ubuntu you should be able to do something like:

sudo a2enmod wsgi
sudo /etc/init.d/apache2 reload

and it will set up the apache configuration for you.

bo.

tan3

unread,
May 2, 2011, 7:56:52 AM5/2/11
to modwsgi
Hello,

I did that command also. But too the error :(

Thank you

Graham Dumpleton

unread,
May 2, 2011, 8:35:55 AM5/2/11
to mod...@googlegroups.com
Follow instructions in:

http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Apache_Modules_Loaded

Specifically, find the Apache httpd executable (which could be named
different on your system) and run it with the -M option.

If you are using standard binary distribution packages and have done
the correct command to enable the module and it still doesn't show
wsgi_module in the list then you have broken somehow your Apache
installation.

What manual changes have you made to Apache configuration files? Are
you using the originals or have you replaced them in whole or in part?

Graham

tan3

unread,
May 2, 2011, 12:23:11 PM5/2/11
to modwsgi
The thing is I use Ubuntu, I did install apache2 and wsgi by the
command

sudo apt-get install apache2 libapache2-mod-wsgi

then following the configuration i enabled a Django project under it,
which is giving this error !!! :|

On May 2, 5:35 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> Follow instructions in:
>
> http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Apache...
>
> Specifically, find the Apache httpd executable (which could be named
> different on your system) and run it with the -M option.
>
> If you are using standard binary distribution packages and have done
> the correct command to enable the module and it still doesn't show
> wsgi_module in the list then you have broken somehow your Apache
> installation.
>
> What manual changes have you made to Apache configuration files? Are
> you using the originals or have you replaced them in whole or in part?
>
> Graham
>

Graham Dumpleton

unread,
May 2, 2011, 7:13:31 PM5/2/11
to mod...@googlegroups.com
Did you run the httpd executable with the -M option as described in
the documentation?

If you want us to help you are going to have to start providing us
more information than "it doesn't work".

So, start with running:

APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data /usr/sbin/apache2 -M

The setting of the two variables on command line may be required
because of non standard changes Ubuntu makes to ASF Apache
distribution.

If you truly did that apt-get command then on Ubuntu 10.10, you should
straight away see that wsgi_module is being loaded.

This is because the mod_wsgi binary package puts in place the file
/etc/apache2/mods-available/wsgi.load and seems to automatically link
it into /etc/apache2/mods-enabled as well.

Check your installation and make sure the original wsgi.load file is
in the mods-available directory and that a symlink exists to it is in
the mods-enabled directory.

Ensure you show the results of your checks, ie., do 'ls -las' on those
directories and post what is in them so we can separate verify their
contents. Also post the contents of the wsgi.load file.

Graham

tan3

unread,
May 3, 2011, 7:39:49 AM5/3/11
to modwsgi
I am sorry for not replying correctly.

I did use this command
APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data /usr/sbin/apache2 -
M
and got the wsgi_module shown

here is its result :
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
mpm_worker_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
reqtimeout_module (shared)
setenvif_module (shared)
status_module (shared)
wsgi_module (shared)
Syntax OK


and the contents of
/etc/apache2/mods-available are :
total 396
12 drwxr-xr-x 2 root root 12288 2011-05-02 17:37 .
4 drwxr-xr-x 7 root root 4096 2011-05-02 17:46 ..
4 -rw-r--r-- 1 root root 332 2010-11-19 02:46 actions.conf
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 actions.load
4 -rw-r--r-- 1 root root 815 2010-11-19 02:46 alias.conf
4 -rw-r--r-- 1 root root 62 2010-11-19 02:46 alias.load
4 -rw-r--r-- 1 root root 60 2010-11-19 02:46 asis.load
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 auth_basic.load
4 -rw-r--r-- 1 root root 74 2010-11-19 02:46 auth_digest.load
4 -rw-r--r-- 1 root root 74 2010-11-19 02:46 authn_alias.load
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 authn_anon.load
4 -rw-r--r-- 1 root root 85 2010-11-19 02:46 authn_dbd.load
4 -rw-r--r-- 1 root root 70 2010-11-19 02:46 authn_dbm.load
4 -rw-r--r-- 1 root root 78 2010-11-19 02:46 authn_default.load
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 authn_file.load
4 -rw-r--r-- 1 root root 90 2010-11-19 02:46 authnz_ldap.load
4 -rw-r--r-- 1 root root 70 2010-11-19 02:46 authz_dbm.load
4 -rw-r--r-- 1 root root 78 2010-11-19 02:46 authz_default.load
4 -rw-r--r-- 1 root root 82 2010-11-19 02:46 authz_groupfile.load
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 authz_host.load
4 -rw-r--r-- 1 root root 74 2010-11-19 02:46 authz_owner.load
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 authz_user.load
4 -rw-r--r-- 1 root root 3265 2010-11-19 02:46 autoindex.conf
4 -rw-r--r-- 1 root root 70 2010-11-19 02:46 autoindex.load
4 -rw-r--r-- 1 root root 62 2010-11-19 02:46 cache.load
4 -rw-r--r-- 1 root root 70 2010-11-19 02:46 cern_meta.load
4 -rw-r--r-- 1 root root 69 2010-11-19 02:46 cgid.conf
4 -rw-r--r-- 1 root root 60 2010-11-19 02:46 cgid.load
4 -rw-r--r-- 1 root root 58 2010-11-19 02:46 cgi.load
4 -rw-r--r-- 1 root root 76 2010-11-19 02:46 charset_lite.load
4 -rw-r--r-- 1 root root 37 2010-11-19 02:46 dav_fs.conf
4 -rw-r--r-- 1 root root 79 2010-11-19 02:46 dav_fs.load
4 -rw-r--r-- 1 root root 58 2010-11-19 02:46 dav.load
4 -rw-r--r-- 1 root root 68 2010-11-19 02:46 dav_lock.load
4 -rw-r--r-- 1 root root 58 2010-11-19 02:46 dbd.load
4 -rw-r--r-- 1 root root 438 2010-11-19 02:46 deflate.conf
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 deflate.load
4 -rw-r--r-- 1 root root 122 2010-11-19 02:46 dir.conf
4 -rw-r--r-- 1 root root 58 2010-11-19 02:46 dir.load
4 -rw-r--r-- 1 root root 604 2010-11-19 02:46 disk_cache.conf
4 -rw-r--r-- 1 root root 89 2010-11-19 02:46 disk_cache.load
4 -rw-r--r-- 1 root root 64 2010-11-19 02:46 dump_io.load
4 -rw-r--r-- 1 root root 58 2010-11-19 02:46 env.load
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 expires.load
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 ext_filter.load
4 -rw-r--r-- 1 root root 89 2010-11-19 02:46 file_cache.load
4 -rw-r--r-- 1 root root 64 2010-11-19 02:46 filter.load
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 headers.load
4 -rw-r--r-- 1 root root 62 2010-11-19 02:46 ident.load
4 -rw-r--r-- 1 root root 68 2010-11-19 02:46 imagemap.load
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 include.load
4 -rw-r--r-- 1 root root 408 2010-11-19 02:46 info.conf
4 -rw-r--r-- 1 root root 60 2010-11-19 02:46 info.load
4 -rw-r--r-- 1 root root 176 2010-11-19 02:46 ldap.conf
4 -rw-r--r-- 1 root root 60 2010-11-19 02:46 ldap.load
4 -rw-r--r-- 1 root root 76 2010-11-19 02:46 log_forensic.load
4 -rw-r--r-- 1 root root 185 2010-11-19 02:46 mem_cache.conf
4 -rw-r--r-- 1 root root 87 2010-11-19 02:46 mem_cache.load
8 -rw-r--r-- 1 root root 7411 2010-11-19 02:46 mime.conf
4 -rw-r--r-- 1 root root 60 2010-11-19 02:46 mime.load
4 -rw-r--r-- 1 root root 81 2010-11-19 02:46 mime_magic.conf
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 mime_magic.load
4 -rw-r--r-- 1 root root 666 2010-11-19 02:46 negotiation.conf
4 -rw-r--r-- 1 root root 74 2010-11-19 02:46 negotiation.load
4 -rw-r--r-- 1 root root 87 2010-11-19 02:46 proxy_ajp.load
4 -rw-r--r-- 1 root root 355 2010-11-19 02:46 proxy_balancer.conf
4 -rw-r--r-- 1 root root 97 2010-11-19 02:46 proxy_balancer.load
4 -rw-r--r-- 1 root root 803 2010-11-19 02:46 proxy.conf
4 -rw-r--r-- 1 root root 95 2010-11-19 02:46 proxy_connect.load
4 -rw-r--r-- 1 root root 141 2010-11-19 02:46 proxy_ftp.conf
4 -rw-r--r-- 1 root root 87 2010-11-19 02:46 proxy_ftp.load
4 -rw-r--r-- 1 root root 89 2010-11-19 02:46 proxy_http.load
4 -rw-r--r-- 1 root root 62 2010-11-19 02:46 proxy.load
4 -rw-r--r-- 1 root root 89 2010-11-19 02:46 proxy_scgi.load
4 -rw-r--r-- 1 root root 64 2010-03-22 03:51 python.load
4 -rw-r--r-- 1 root root 429 2010-11-19 02:46 reqtimeout.conf
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 reqtimeout.load
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 rewrite.load
4 -rw-r--r-- 1 root root 1211 2010-11-19 02:46 setenvif.conf
4 -rw-r--r-- 1 root root 68 2010-11-19 02:46 setenvif.load
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 speling.load
4 -rw-r--r-- 1 root root 2750 2010-11-19 02:46 ssl.conf
4 -rw-r--r-- 1 root root 58 2010-11-19 02:46 ssl.load
4 -rw-r--r-- 1 root root 753 2010-11-19 02:46 status.conf
4 -rw-r--r-- 1 root root 64 2010-11-19 02:46 status.load
4 -rw-r--r-- 1 root root 72 2010-11-19 02:46 substitute.load
4 -rw-r--r-- 1 root root 64 2010-11-19 02:46 suexec.load
4 -rw-r--r-- 1 root root 70 2010-11-19 02:46 unique_id.load
4 -rw-r--r-- 1 root root 604 2010-11-19 02:46 userdir.conf
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 userdir.load
4 -rw-r--r-- 1 root root 70 2010-11-19 02:46 usertrack.load
4 -rw-r--r-- 1 root root 66 2010-11-19 02:46 version.load
4 -rw-r--r-- 1 root root 74 2010-11-19 02:46 vhost_alias.load
8 -rw-r--r-- 1 root root 5055 2010-05-14 06:02 wsgi.conf
4 -rw-r--r-- 1 root root 60 2010-05-14 06:02 wsgi.load

and
/etc/apache2/mods-enabled are :
total 8
4 drwxr-xr-x 2 root root 4096 2011-05-02 18:08 .
4 drwxr-xr-x 7 root root 4096 2011-05-02 17:46 ..
0 lrwxrwxrwx 1 root root 28 2011-04-27 04:16 alias.conf -> ../mods-
available/alias.conf
0 lrwxrwxrwx 1 root root 28 2011-04-27 04:16 alias.load -> ../mods-
available/alias.load
0 lrwxrwxrwx 1 root root 33 2011-04-27 04:16 auth_basic.load -> ../
mods-available/auth_basic.load
0 lrwxrwxrwx 1 root root 33 2011-04-27 04:16 authn_file.load -> ../
mods-available/authn_file.load
0 lrwxrwxrwx 1 root root 36 2011-04-27 04:16 authz_default.load -
> ../mods-available/authz_default.load
0 lrwxrwxrwx 1 root root 38 2011-04-27 04:16 authz_groupfile.load -
> ../mods-available/authz_groupfile.load
0 lrwxrwxrwx 1 root root 33 2011-04-27 04:16 authz_host.load -> ../
mods-available/authz_host.load
0 lrwxrwxrwx 1 root root 33 2011-04-27 04:16 authz_user.load -> ../
mods-available/authz_user.load
0 lrwxrwxrwx 1 root root 32 2011-04-27 04:16 autoindex.conf -> ../
mods-available/autoindex.conf
0 lrwxrwxrwx 1 root root 32 2011-04-27 04:16 autoindex.load -> ../
mods-available/autoindex.load
0 lrwxrwxrwx 1 root root 27 2011-05-02 17:37 cgid.conf -> ../mods-
available/cgid.conf
0 lrwxrwxrwx 1 root root 27 2011-05-02 17:37 cgid.load -> ../mods-
available/cgid.load
0 lrwxrwxrwx 1 root root 30 2011-04-27 04:16 deflate.conf -> ../mods-
available/deflate.conf
0 lrwxrwxrwx 1 root root 30 2011-04-27 04:16 deflate.load -> ../mods-
available/deflate.load
0 lrwxrwxrwx 1 root root 26 2011-04-27 04:16 dir.conf -> ../mods-
available/dir.conf
0 lrwxrwxrwx 1 root root 26 2011-04-27 04:16 dir.load -> ../mods-
available/dir.load
0 lrwxrwxrwx 1 root root 26 2011-04-27 04:16 env.load -> ../mods-
available/env.load
0 lrwxrwxrwx 1 root root 27 2011-04-27 04:16 mime.conf -> ../mods-
available/mime.conf
0 lrwxrwxrwx 1 root root 27 2011-04-27 04:16 mime.load -> ../mods-
available/mime.load
0 lrwxrwxrwx 1 root root 34 2011-04-27 04:16 negotiation.conf -> ../
mods-available/negotiation.conf
0 lrwxrwxrwx 1 root root 34 2011-04-27 04:16 negotiation.load -> ../
mods-available/negotiation.load
0 lrwxrwxrwx 1 root root 33 2011-04-27 04:16 reqtimeout.conf -> ../
mods-available/reqtimeout.conf
0 lrwxrwxrwx 1 root root 33 2011-04-27 04:16 reqtimeout.load -> ../
mods-available/reqtimeout.load
0 lrwxrwxrwx 1 root root 31 2011-04-27 04:16 setenvif.conf -> ../
mods-available/setenvif.conf
0 lrwxrwxrwx 1 root root 31 2011-04-27 04:16 setenvif.load -> ../
mods-available/setenvif.load
0 lrwxrwxrwx 1 root root 29 2011-04-27 04:16 status.conf -> ../mods-
available/status.conf
0 lrwxrwxrwx 1 root root 29 2011-04-27 04:16 status.load -> ../mods-
available/status.load
0 lrwxrwxrwx 1 root root 27 2011-05-02 18:08 wsgi.conf -> ../mods-
available/wsgi.conf
0 lrwxrwxrwx 1 root root 27 2011-05-02 18:08 wsgi.load -> ../mods-
available/wsgi.load


On May 3, 4:13 am, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> Did you run the httpd executable with the -M option as described in
> the documentation?
>
> If you want us to help you are going to have to start providing us
> more information than "it doesn't work".
>
> So, start with running:
>
>   APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data /usr/sbin/apache2 -M
>
> The setting of the two variables on command line may be required
> because of non standard changes Ubuntu makes to ASF Apache
> distribution.
>
> If you truly did that apt-get command then on Ubuntu 10.10, you should
> straight away see that wsgi_module is being loaded.
>
> This is because the mod_wsgi binary package puts in place the file
> /etc/apache2/mods-available/wsgi.load and seems to automatically link
> it into /etc/apache2/mods-enabled as well.
>
> Check your installation and make sure the original wsgi.load file is
> in the mods-available directory and that a symlink exists to it is in
> the mods-enabled directory.
>
> Ensure you show the results of your checks, ie., do 'ls -las' on those
> directories and post what is in them so we can separate verify their
> contents. Also post the contents of the wsgi.load file.
>
> Graham
>

Graham Dumpleton

unread,
May 3, 2011, 7:45:26 AM5/3/11
to mod...@googlegroups.com
Have you tried doing a complete stop and then start of Apache and not
just a reload?

A reload is actually just a restart which doesn't actually shutdown
Apache. Usually a restart is all that is needed, but a complete
stop/start is worth a try.

Also post the contents of the wsgi.load file as I asked previously.

Graham

tan3

unread,
May 3, 2011, 9:48:35 PM5/3/11
to modwsgi
Hello Graham,

this is the content of wsgi.load
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

I even reloaded , stopped and did all that with apache. Is it
something wrong with my System as in the Operating system not getting
installed or is it corrupt?

Thanks for your patience.. I am thinking to reinstall everything and
start from scratch. Will i proceed?

Nagaraj

On May 3, 4:45 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> Have you tried doing a complete stop and then start of Apache and not
> just a reload?
>
> A reload is actually just a restart which doesn't actually shutdown
> Apache. Usually a restart is all that is needed, but a complete
> stop/start is worth a try.
>
> Also post the contents of the wsgi.load file as I asked previously.
>
> Graham
>
> ...
>
> read more »

Graham Dumpleton

unread,
May 3, 2011, 10:34:32 PM5/3/11
to mod...@googlegroups.com
I can only think of two things.

1. Where you have placed WSGIScriptAlias means it is being loaded
before wsgi.load is included. This is doubtful based on you saying it
is in default site definition.

2. You have managed to include some hidden control characters or odd
unicode characters in the WSGIScriptAlias line.

I would suggest the following as first step.

1. Comment out WSGIScriptAlias line.

2. In wsgi.load add a line:

XXX

and do a config test.

'XXX' is an error and Apache should thus give an error. If it doesn't,
then wsgi.load isn't being loaded for some reason.

3. If does error, then get rid of the 'XXX' and in site default file add:

<IfModule mod_wsgi.c>
XXX
</IfModule>

Do config test again. If that doesn't error, then mod_wsgi not being
loaded by time default site file loaded.

Graham

tan3

unread,
May 5, 2011, 4:26:13 AM5/5/11
to modwsgi
Hello,

I am sorry, as I was in very urgent, I just re installed Ubuntu and
along with it apache2 + wsgi.
Now it is working properly.

**Thank you very much for your patience.**

On May 3, 10:34 pm, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> I can only think of two things.
>
> 1. Where you have placed WSGIScriptAlias means it is being loaded
> before wsgi.load is included. This is doubtful based on you saying it
> is in default site definition.
>
> 2. You have managed to include some hidden control characters or odd
> unicode characters in the WSGIScriptAlias line.
>
> I would suggest the following as first step.
>
> 1. Comment out WSGIScriptAlias line.
>
> 2. In wsgi.load add a line:
>
>    XXX
>
> and do a config test.
>
> 'XXX' is an error and Apache should thus give an error. If it doesn't,
> then wsgi.load isn't being loaded for some reason.
>
> 3. If does error, then get rid of the 'XXX' and in site default file add:
>
>   <IfModule mod_wsgi.c>
>   XXX
>   </IfModule>
>
> Do config test again. If that doesn't error, then mod_wsgi not being
> loaded by time default site file loaded.
>
> Graham
>
> ...
>
> read more »
Reply all
Reply to author
Forward
0 new messages