WSGIScriptAlias覆盖Alias
我在配置Apache 2.2和mod_wsgi的时候遇到了一些问题。我希望mod_wsgi能够处理虚拟服务器根目录下的所有内容,除了某些特定的路径。对于这些特定的路径,我希望能使用普通的Apache目录列表功能。以下是我目前的虚拟服务器配置,它部分有效。mod_wsgi对直接指向文件的路径没有反应,但对目录却能正常工作。我搞不明白这是为什么。我查看了这里的文档 - https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide。文档中提到如何使用别名来禁用mod_wsgi,但没有提到我遇到的问题。(顺便提一下,foo.wsgi
这个端点只是个“你好,世界”的示例)。
<VirtualHost *:80>
ServerAdmin webmaster@test.wsgi.sethandler.localdomain
ServerName test.wsgi.sethandler.localdomain
DocumentRoot /var/www/test.wsgi.sethandler.localdomain
<Directory /var/www/test.wsgi.sethandler.localdomain>
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo Options Indexes
Order allow,deny
allow from all
</Directory>
Alias /static /var/www/test.wsgi.sethandler.localdomain/static
WSGIScriptAlias / /var/www/test.wsgi.sethandler.localdomain/cgi-bin/foo.wsgi
<Directory /var/www/test.wsgi.sethandler.localdomain/cgi-bin>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
我尝试用以下方法禁用任何处理程序,但没有成功:
<Location "/static">
SetHandler None
</Location>
<LocationMatch ^/static>
SetHandler None
</LocationMatch>
1 个回答
0
你试过在static后面加一个结束斜杠吗?
Alias /static/ /var/www/test.wsgi.sethandler.localdomain/static/
<Directory /var/www/test.wsgi.sethandler.localdomain/static/>
Require all granted
</Directory>
WSGIScriptAlias / /var/www/test.wsgi.sethandler.localdomain/cgi-bin/foo.wsgi