【发布时间】:2015-08-10 22:49:31
【问题描述】:
我在 Windows 上,正在尝试在 Apache 服务器上调用 mod_wsgi。我在 /usr/lib/apache2/modules/ 中找到了 mod_wsgi.so,并且我有一个名为 MyApp - /home/danu_bg/public_html/MyApp 的目录。
在这个目录中我有application.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]
而.htaccess的配置文件是
<Directory /home/danu_bg/public_html/MyApp>
WSGIScriptAlias /home/danu_bg/public_html/MyApp/application.wsgi
Order allow,deny
Allow from all
</Directory>
我不认为我可以访问主配置文件,httpd.config 当我查看 /usr/lib/apache2/build 时,我看到 config.nice 但没有看到 httpd.config
我正在使用 WinSCP 连接到服务器,我没有 shell 访问权限。 当我转到 URL 时,我收到此错误
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request
【问题讨论】:
-
您不能将 Directory/WSGIScriptAlias 放在 .htaccess 文件中。 mod_wsgi.so 在系统上是不够的,必须配置 Apache 来加载它。您确实需要从主机提供商那里了解 Apache 是否甚至被配置为加载 mod_wsgi。如果它是一个共享系统,他们不应该允许您使用 .htaccess 文件中的 mod_wsgi,因为这样做会带来安全风险,除非他们采取了特殊措施来配置 mod_wsgi 以将您的应用程序隔离到它自己的进程中。
标签: python apache .htaccess mod-wsgi