[Twisted-Python] Serving web content over SSL

Tommi Virtanen tv at tv.debian.net
Wed Oct 1 02:43:33 EDT 2003

Thomas Weholt wrote:
> Can anybody provide a working, simple example of a SSL-capable web-server
> using Twisted ?
> Any hints or clues regarding installation of openssl or other required
> library is also interesting.


deb http://twistedmatrix.com/~moshez/apt/ ./

cvs -d :ext:cvs.twistedmatrix.com:/cvs co TwistedWebDeb

Put this in /etc/twisted-web/local.d/20ssl

from twisted.internet import reactor, ssl
from twisted.web import static, server

port = 443

ctx  = ssl.DefaultOpenSSLContextFactory(
application.listenSSL(port, site, ctx)

Of course, you'll need to create the SSL key with openssl.

More information about the Twisted-Python mailing list