安装mod_wsgi给出403错误
httpd.conf我添加了下面的代码
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]
注意:localhost是我的虚拟主机域,它工作正常,但是当我请求http://localhost/wsgi/ got 403错误。
<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>
错误日志
[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
注意:我的apache不在c:/ xampp / bin / apache中,它位于c:/ xampp / bin / server-apache /
您在<Directory>和<VirtualHost>指令中使用不同的目录。
在你的Directory指令中
<Directory "C:/xampp/htdocs/wsgi_app/">
在你有VirtualHost
DocumentRoot "C:/xampp/www/htdocs/localhost"
您需要修复它,以便访问规则和DocumentRoot同意您要使用的目录。
错误提示:对于c:/xampp/www/htdocs/wsgi_app/wsgi_handler.py目录,Options ExecCGI已closures。
您是否尝试过打开Options ExecCGI? 更改Options None到Options +ExecCGI
您不允许访问文档根目录,只能访问WSGI根目录。
在<VirtualHost *:80>块中添加:
<Directory "C:/xampp/www/htdocs/localhost"> Order allow,deny Allow from all </Directory>