Skip to main content

A simple httpS server for development

Blog post   •   Sep 24, 2014 09:11 GMT

Last day, I had to serve some html pages via HTTPS. But didn't really know any simple solution to do this.

Here is one. A simple wrapper of the python SimpleHTTPServer with support for SSL.

Before running the server, you'll need to create your certificate :

<code>openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes</code>

Now that you have your certificate, create a file srv.py :

gist

Add this file to your path, or simply call it from wherever you want like that :

/path/to/srv.py

This will serve the file in your current directory on https://localhost:4443

If you need a non httpS version to simply serve som static file, you can use the standard python simpleHTTPServer like this :

python -m SimpleHTTPServer

Comments (4)

    Hi!

    Thanks for such a knowledgeable post.

    <a href="http://bit.do/solidiance">Solidiance</a>

    - Solidiance - Apr 26, 2016 11:17 GMT

    Hi!

    Thanks for such a knowledgeable post.

    - Kopi Hijau - Jun 09, 2016 03:54 GMT

    Hi!

    Thanks for such a knowledgeable post.

    <a href="http://www.jefton.com">Jefton</a>

    - masker kefir - Nov 15, 2016 17:42 GMT

    Inspirasi baju kaos menarik

    <a href="https://konveksi.me/">konveksi sablon jakarta</a>

    - koveksi7 - Oct 22, 2017 02:38 GMT

Add comment

Comment