1

installing mod_wsgi giving 403 error

httpd.conf i added code below

WSGIScriptAlias /wsgi "C:/xampp/www/htdocs/wsgi_app/wsgi_handler.py"

   <Directory "C:/xampp/www/htdocs/wsgi_app/">
    AllowOverride None
    Options None
    Order deny,allow
    Allow from all
    </Directory>

wsgi_handler.py

status = ‘200 OK’
output = ‘Hello World!’
response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]

Note: localhost is my virtual host domain and it is working fine but when i request http://localhost/wsgi/ got 403 error.

<VirtualHost *:80>
    ServerAdmin postmaster@dummy-host2.localhost
    DocumentRoot "C:/xampp/www/htdocs/localhost"
    ServerName localhost
    ServerAlias www.localhost
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" combined
</VirtualHost>

Error log

[Wed Jul 04 06:01:54 2012] [error] [client 127.0.0.1] File does not exist: C:/xampp/www/htdocs/localhost/favicon.ico
[Wed Jul 04 06:01:54 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/xampp/Bin/apache
[Wed Jul 04 06:01:58 2012] [error] [client 127.0.0.1] Options ExecCGI is off in this directory: C:/xampp/www/htdocs/wsgi_app/wsgi_handler.py
[Wed Jul 04 06:01:58 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/xampp/Bin/apache
[Wed Jul 04 06:01:58 2012] [error] [client 127.0.0.1] File does not exist: C:/xampp/www/htdocs/localhost/favicon.ico
[Wed Jul 04 06:01:58 2012] [error] [client 127.0.0.1] client denied by server configuration: C:/xampp/Bin/apache

Note: My apache is not in c:/xampp/bin/apache it is in c:/xampp/bin/server-apache/

3 Answers3

3

You're using different directories in your <Directory> and you <VirtualHost> directives.

In your Directory directive you've got

 <Directory "C:/xampp/htdocs/wsgi_app/">

In the VirtualHost you've got

DocumentRoot "C:/xampp/www/htdocs/localhost"

You need to fix it so the access rules and the DocumentRoot agree on the directory you want to use.

Jenny D
  • 27,780
  • 21
  • 75
  • 114
  • ok i will try and inform you. – John Smiith Jul 04 '12 at 13:12
  • i fixed but still getting 403 error,My apache is not in c:/xampp/bin/apache it is in c:/xampp/bin/server-apache/ – John Smiith Jul 04 '12 at 14:16
  • There are three errors in your log. 1) ExecCGI isn't set, se the answer by tfitzgerald. 2) You don't have a favicon.ico, this one you can disregard. 3) Somewhere you have some configuration pointing at c:/xampp/Bin/apache - search for that string in your config file (it may be your DocumentRoot) and replace it with the directory where you actually store your files. – Jenny D Jul 05 '12 at 08:06
1

The error says that Options ExecCGI is off for the c:/xampp/www/htdocs/wsgi_app/wsgi_handler.py directory.

Have you tried turning Options ExecCGI on? Change Options None to Options +ExecCGI

tfitzgerald
  • 443
  • 3
  • 6
0

You're not allowing access to the document root, just the WSGI root.

Add this within your <VirtualHost *:80> block:

<Directory "C:/xampp/www/htdocs/localhost">
    Order allow,deny
    Allow from all
</Directory>
Shane Madden
  • 114,520
  • 13
  • 181
  • 251