我试图在ubuntu 12.04 LTS上的apache 2.2.22中运行测试wsgi应用程序 . 在同一个apache中还有另外两个php网站 .
我在/ var / www / wsgi文件夹中有以下app.wsgi .
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
但是,当我在浏览器中打开链接时,它会在浏览器中打开该目录 . 当我尝试打开app.wsgi时,它会按原样显示源文件 . 它无法通过WSGI执行代码 .
我已经安装了libapache2-mod-wsgi . 下面是这个虚拟主机的apache设置 - / etc / apache2 / sites-available中的wsgi.conf .
<VirtualHost *:80>
ServerName xyz
DocumentRoot /var/www/wsgi
<Directory /var/www/wsgi>
Options Indexes FollowSymLinks MultiViews ExecCGI
AddHandler cgi-script .cgi
AddHandler wsgi-script .wsgi
AllowOverride None
Order allow,deny
allow from all
</Directory>
WSGIScriptAlias /wsgi /var/www/wsgi/app.wsgi
LogLevel info
ErrorLog "/var/www/wsgi/error.log"
CustomLog "/var/www/wsgi/access.log" combined
</VirtualHost>
请帮我解决这个问题 . 我已经执行了a2dissite默认值 . 我为托管的其他网站执行了a2nsite,这些网站运行正常 .
1 回答
你为什么试试"opening the app.wsgi"?您的WSGIScriptAlias设置为
\wsgi
,因此这是您应该去的地址 .