【问题标题】:cherrypy/wsgi behind apache sslapache ssl背后的cherrypy/wsgi
【发布时间】:2013-06-20 05:54:47
【问题描述】:

我写了一个cherrypy 应用程序,现在我需要SSL。我正在使用 apache/wsgi 并且有一个运行和返回页面的工作 python 文件。现在我正在尝试让 POST 工作。

这是我的工作脚本:

import sys
sys.stdout = sys.stderr

import atexit
import threading
import cherrypy

cherrypy.config.update({'environment': 'embedded'})

if cherrypy.engine.state == 0:
    cherrypy.engine.start(blocking=False)
    atexit.register(cherrypy.engine.stop)

class Root(object):
    def index(self):
        # restrict access by ip address
        clientIP = cherrypy.request.headers["Remote-Addr"]
        if clientIP not in self.allowedIPs:
            return "Access Denied"

        return cherrypy.url()

    index.exposed = True
    allowedIPs = ["127.0.0.1", "192.168.174.1"]

application = cherrypy.Application(Root(), None)

如果我进行修改以赶上帖子:

class Root(object):
    def index(self, files):

我收到以下错误:

    <h2>404 Not Found</h2>
    <p>Nothing matches the given URI</p>

我的 apache 配置,

WSGISocketPrefix run/wsgi
NameVirtualHost *:443
<VirtualHost *:443>
        DocumentRoot /var/www/ssl_html
        ServerName   192.168.174.130:443
        ServerAlias 192.168.174.130

        SSLEngine On
        SSLCertificateFile /etc/ssl/certs/devel.crt
        SSLCertificateKeyFile /etc/ssl/certs/devel.key
        <Location />
                SSLRequireSSL
        </Location>

        WSGIDaemonProcess 192.168.174.130 processes=2 threads=15 display-name=%{GROUP}
        WSGIProcessGroup 192.168.174.130

        WSGIScriptAlias / /var/www/wsgi-scripts/helloWorld.py

</VirtualHost>

任何帮助将不胜感激! :)

【问题讨论】:

    标签: apache wsgi cherrypy


    【解决方案1】:
    def index(self, files):
    

    应该是

    def index(self, file):
    

    啊!!唉,修好了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-09
      • 2012-04-19
      • 2014-06-15
      • 1970-01-01
      • 2015-09-25
      • 2016-07-20
      • 1970-01-01
      • 2010-11-30
      相关资源
      最近更新 更多