2016-01-17 237 views
0

我有一個小的應用程序寫在cherrypy頂部。我想在默認的cherrypy服務器下運行它。我有我的域名+我的ssl通過Comodo驗證的證書。我一直試圖在一個簡單的應用程序下運行24小時,沒有任何運氣。我已經寫了一個測試應用程序,如下所示:CherryPy ssl證書

import cherrypy 

class RootServer: 
    @cherrypy.expose 
    def index(self, **keywords): 
     return "SSL HERE WE COME!!!!" 


if __name__ == '__main__': 
    server_config={ 
     'server.socket_host': 'mydomain.com', 
     'server.socket_port':443, 

     'server.ssl_module':'pyopenssl', 
     'server.ssl_certificate':'/var/www/certs/mydomain_com.crt', 
     'server.ssl_private_key':'/var/www/certs/mydomain.com.key', 
     'server.ssl_certificate_chain':'/var/www/certs/bundle.pem' 
    } 

    cherrypy.config.update(server_config) 
    cherrypy.quickstart(RootServer()) 

它沒有任何問題就啓動了。但是,當我嘗試訪問它時,我得到以下內容:

[email protected]:~> openssl s_client -connect mydomain.com:443 -state -nbio 2>&1 | grep "^SSL" 
SSL_connect:before/connect initialization 
SSL_connect:SSLv2/v3 write client hello A 
SSL_connect:error in SSLv2/v3 read server hello A 
SSL3 alert read:fatal:handshake failure 
SSL_connect:error in SSLv2/v3 read server hello A 
SSL handshake has read 7 bytes and written 261 bytes 

我該做什麼錯?

回答

0

花了我一段時間弄清楚,但我得到它運行。如果有人碰到同一個搖滾樂,請留言:

import cherrypy 

class RootServer: 
    @cherrypy.expose 
    def index(self, **keywords): 
     return 'Success!' 

if __name__ == '__main__': 
    server_config={ 
     'server.socket_host': 'mydomain.com', 
     'server.socket_port':443, 

     'server.ssl_module':'pyopenssl', 
     'server.ssl_certificate':'/home/axe/CERTS/domain.crt', 
     'server.ssl_private_key':'/home/axe/CERTS/myserver.key', 
    } 

    cherrypy.config.update(server_config) 
    cherrypy.quickstart(RootServer())