Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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/

share|improve this question
    
Got error logs? –  womble Jul 4 '12 at 12:54
    
Questions typically involve a question mark somewhere. –  womble Jul 4 '12 at 15:16
    
Normally you would have the WSGIScriptAlias and Directory block inside of the VirtualHost not outside. This would restrict it to that one virtual host. –  Graham Dumpleton Jul 4 '12 at 23:55
add comment

3 Answers

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.

share|improve this answer
    
ok i will try and inform you. –  John Smiith Jul 4 '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 4 '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 5 '12 at 8:06
add comment

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

share|improve this answer
add comment

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>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.