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 [email protected] 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
  • Got error logs? Commented Jul 4, 2012 at 12:54
  • Questions typically involve a question mark somewhere. Commented Jul 4, 2012 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. Commented Jul 4, 2012 at 23:55

3 Answers 3

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.

3
  • ok i will try and inform you. Commented Jul 4, 2012 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/ Commented Jul 4, 2012 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. Commented Jul 5, 2012 at 8: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

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> 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.