おすすめ:Twisted(http://twistedmatrix.com)
Pythonで記述され、オープンソースのMITライセンスの下でライセンスされているイベント駆動型ネットワークエンジン。
クロスプラットフォームであり、OSX10.5から10.12にプレインストールされています。特に、現在のディレクトリで次のコマンドを使用して単純なWebサーバーを起動できます。
twistd -no web --path=.
詳細
オプションの説明(詳細はtwistd --help
を参照):
-n, --nodaemon don't daemonize, don't use default umask of 0077
-o, --no_save do not save state on shutdown
「web」は、Twisted非同期エンジン上で単純なWebサーバーを実行するコマンドです。また、コマンドラインオプションも受け入れます(「web」コマンドの後-詳細については、を参照twistd web --help
してください)。
--path= <path> is either a specific file or a directory to be
set as the root of the web server. Use this if you
have a directory full of HTML, cgi, php3, epy, or rpy
files or any other files that you want to be served up
raw.
次のような他のコマンドもたくさんあります。
conch A Conch SSH service.
dns A domain name server.
ftp An FTP server.
inetd An inetd(8) replacement.
mail An email service
... etc
インストール
Ubuntu
sudo apt-get install python-twisted-web (or python-twisted for the full engine)
Mac OS-X(10.5〜10.12にプリインストールされているか、MacPortsおよびPipから入手可能)
sudo port install py-twisted
ウィンドウズ
installer available for download at http://twistedmatrix.com/
HTTPS
Twistedは、セキュリティ証明書を利用して接続を暗号化することもできます。これは、既存のオプション--path
および--port
(プレーンHTTPの場合)オプションで使用します。
twistd -no web -c cert.pem -k privkey.pem --https=4433