问题
I'm on Windows, and am trying to invoke mod_wsgi on an Apache server. I located mod_wsgi.so in /usr/lib/apache2/modules/
and I have a directory called MyApp - /home/danu_bg/public_html/MyApp
.
Within this directory I have 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]
And the .htaccess
configuration file is
<Directory /home/danu_bg/public_html/MyApp>
WSGIScriptAlias /home/danu_bg/public_html/MyApp/application.wsgi
Order allow,deny
Allow from all
</Directory>
I don't think I can access the main configuration file, httpd.config
when I look in /usr/lib/apache2/build
I see config.nice
but don't see httpd.config
I'm using WinSCP to connect to the server, I do not have shell access. When I go to the URL, I get this error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request
回答1:
When I look at the page https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives
I see the following syntax for the WSGIScriptAlias
directive:
WSGIScriptAlias /name /web/wsgi-scripts/name
So the directive takes two arguments: the URI and the wsgi script. In your case that might be something like:
WSGIScriptAlias /app /public_html/MyApp/application.wsgi
to expose your application under the /app URL.
来源:https://stackoverflow.com/questions/30506385/hello-world-using-mod-wsgi-internal-error-misconfiguration