【问题标题】:cherrypy https script not working with linux startupcherrypy https 脚本不适用于 linux 启动
【发布时间】:2015-04-28 02:02:57
【问题描述】:

尝试在 linux 启动时运行一个cherrypy https 服务器。启动脚本适用于运行 http 的cherrypy,但不适用于 https。此外,当手动运行 https 服务器时,它可以工作,所以那里没有库问题。总结和错误如下:

  1. https 和 http 服务器在 linux 上手动运行时可以正常工作
  2. http 正在启动 linux
  3. https 在 linux 启动时不起作用

我把https启动脚本的结果输出到一个文本文件,遇到这个错误:

[25/Feb/2015:13:59:03] ENGINE Bus STARTING
[25/Feb/2015:13:59:03] ENGINE Started monitor thread '_TimeoutMonitor'.
[25/Feb/2015:13:59:03] ENGINE Started monitor thread 'Autoreloader'.
[25/Feb/2015:13:59:03] ENGINE Serving on 0.0.0.0:8099
[25/Feb/2015:13:59:03] ENGINE Bus STARTED
[25/Feb/2015:13:59:03] ENGINE Error in HTTPServer.tick
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py", line 1837, in start
    self.tick()
  File "/usr/local/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py", line 1902, in tick
    s, ssl_env = self.ssl_adapter.wrap(s)
  File "/usr/local/lib/python2.7/site-packages/cherrypy/wsgiserver/ssl_builtin.py", line 52, in wrap
    keyfile=self.private_key, ssl_version=ssl.PROTOCOL_SSLv23)
  File "/usr/local/lib/python2.7/ssl.py", line 387, in wrap_socket
    ciphers=ciphers)
  File "/usr/local/lib/python2.7/ssl.py", line 141, in __init__
    ciphers)
SSLError: [Errno 336265218] _ssl.c:351: error:140B0002:SSL routines:SSL_CTX_use_PrivateKey_file:system lib

我将包含脚本的文件夹的权限设置为“chmod 777”,即授予所有用户/组的所有权限。没有运气。

【问题讨论】:

  • 什么是“启动脚本”,init.d 脚本?什么发行版?

标签: python linux https cherrypy init.d


【解决方案1】:

您很可能设置了证书的相对路径,或者它没有读取权限。

仔细检查证书的路径。使用绝对的,并留意任何需要的转义字符。 \

【讨论】:

    【解决方案2】:

    修复了解决方案,cyraxjoe 是对的。它最终是 init.d 脚本从 etc/init.d/ 运行 python 服务器文件,而私钥文件使用的是相对路径。使用绝对路径最终解决了问题。

    谢谢!!!

    【讨论】:

      猜你喜欢
      • 2021-10-27
      • 1970-01-01
      • 2020-12-22
      • 2021-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多