[Twisted-Python] Serving web content over SSL

Tommi Virtanen tv at tv.debian.net
Wed Oct 1 00:43:33 MDT 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.

twisted-web

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(
	'/etc/twisted-web/ssl/private/privkey.pem',
         '/etc/twisted-web/ssl/cert.pem')
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