简体   繁体   English

Hello World 使用 mod_wsgi,内部错误,错误配置

[英]Hello World using mod_wsgi, Internal error, misconfiguration

I'm on Windows, and am trying to invoke mod_wsgi on an Apache server.我在 Windows,并试图在 Apache 服务器上调用 mod_wsgi。 I located mod_wsgi.so in /usr/lib/apache2/modules/ and I have a directory called MyApp - /home/danu_bg/public_html/MyApp .我在/usr/lib/apache2/modules/中找到了 mod_wsgi.so 并且我有一个名为 MyApp 的目录 - /home/danu_bg/public_html/MyApp

Within this directory I have application.wsgi在这个目录中我有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.htaccess的配置文件是

<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我不认为我可以访问主配置文件httpd.config当我查看/usr/lib/apache2/build我看到config.nice但没有看到httpd.config

I'm using WinSCP to connect to the server, I do not have shell access.我正在使用 WinSCP 连接到服务器,我没有 shell 访问权限。 When I go to the URL, I get this error当我 go 到 URL 时,我得到这个错误

 Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request

When I look at the page https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives 当我查看页面https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives时

I see the following syntax for the WSGIScriptAlias directive: 我看到了WSGIScriptAlias指令的以下语法:

WSGIScriptAlias /name /web/wsgi-scripts/name

So the directive takes two arguments: the URI and the wsgi script. 因此,该指令采用两个参数:URI和wsgi脚本。 In your case that might be something like: 在您的情况下,可能类似于:

WSGIScriptAlias /app /public_html/MyApp/application.wsgi WSGIScriptAlias / app /public_html/MyApp/application.wsgi

to expose your application under the /app URL. 在/ app URL下显示您的应用程序。

maybe its the a form of indentation error present when a newtyper tries to type something:可能是新打字员尝试输入内容时出现的一种缩进错误:

-> now im getting 404: https://pastebin.com/LgvyNWVX fix with vhost file default_vhost_wsgi -> 现在我得到 404: https://pastebin.com/LgvyNWVX修复虚拟主机文件 default_vhost_wsgi

--zeroing: ok RIGHT RIGHT YOU WONT FIND theyre like were of a crossing - convenient store make it jcpennies OK RIGHT RIGHT: and how theyre using the same thing to differ like the data being sent on this tab received: <- between a school and: find the root of target co oh but im just learning:will POP - OPEN THIS ARRAY software BUTTON ARRAY; --zeroing:好的,对,你不会发现它们就像是一个十字路口 - 便利店让它成为 jcpennies并且:找到目标 co 的根 哦,但我只是在学习:将 POP - 打开这个阵列软件 BUTTON ARRAY; means theyre all like but was i doing:意味着他们都喜欢但我在做什么:

  • and then save it as a file is from MASM/NASA: [p[[pedp[entheglypbuttons然后将其保存为来自 MASM/NASA 的文件:[p[[pedp[entheglypbuttons

1.: set up virtual host on port 8080: is has to specify this in the url: as a separate vhost file like 00_default_vhost_wsgi: https://pastebin.com/CMdgj4Ne : and its ***WORKING: 1.:在端口 8080 上设置虚拟主机:必须在 url 中将其指定为单独的虚拟主机文件,如 00_default_vhost_wsgi: https://pastebin.com/CMdgj4Ne :及其 *** 工作:

...if you want to fix it: https://pastebin.com/HEyscL7T WSGIScriptAlias /python_helloworld_wsgi "/var/www/localhost/wsgi-scripts/python_helloworld.wsgi" ...如果你想修复它: https://pastebin.com/HEyscL7T WSGIScriptAlias /python_helloworld_wsgi "/var/www/localhost/wsgi-scripts/python_helloworld.wsgi"

<Directory "/var/www/localhost/wsgi-scripts"> Options ExecCGI AddHandler cgi-script.cgi AddHandler wsgi-script.wsgi Require all granted <Directory "/var/www/localhost/wsgi-scripts"> Options ExecCGI AddHandler cgi-script.cgi AddHandler wsgi-script.wsgi 要求全部授予

;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;

https://pastebin.com/exSCDPY7 https://pastebin.com/exSCDPY7

'def application(environ, start_response): status = '200 OK' output = b'Hello, World!' 'def application(environ, start_response): status = '200 OK' output = b'Hello, World!'

response_headers = [('Content-type', 'text/plain'),
                    ('Content-Length', str(len(output)))]
start_response(status, response_headers)

return [output]'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM