「サーバ構築/簡易サーバ」

本来VMや物理サーバを立ててそこにwwwサーバを立てるべきなのだが、ソースを書いた直後に
実行結果を見て確認したい、という場合はビルトインサーバや簡易サーバを使うと便利である。


・ビルトインサーバ

言語 ver コマンド
Python 2.4 python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000
Python 3.x python -m http.server 8000
Ruby WEBRick ruby -rwebrick -e 'WEBrick::HTTPServer.new(:DocumentRoot => "./", :Port => 8000).start'
Ruby HTTPS ruby -rwebrick -rwebrick/https -e 'WEBrick::HTTPServer.new(:DocumentRoot => "./", :Port => 8000, :SSLEnable => true,
Ruby Sinatra ruby -rsinatra -e 'set :public_folder, "./", get("/"){"Hello world"}'
Ruby Sinatra ruby -rsinatra -e 'set :port, 8000; set :public_folder, "./", get("/"){"Hello world"}'
PHP 5.4 php -S localhost:8000
PHP 5.4 php -S 0.0.0.0:8000
Ruby un Lib ruby -run -e httpd . -p 8000
Python [index.py]
print "Content-Type: text/plain"
print
print "hello world."
^D (←コントロール+Dを押してください)

python -m CGIHTTPServer

Perl [cpanインストール]
cpan
sudo cpan Task::Plack

plackup -MPlack::App::Directory -e 'Plack::App::Directory->new({root=>$ENV{PWD}})->to_app' HTTP::Server::PSGI: Accepting connections at http://0:5000/
node.js グローバル [インストール]
npm install -g http-server

http-server -p 8000
node.js ローカル [インストール]
npm install http-server

./node_modules/.bin/http-server -p 8000
node.js serve [インストール]
npm install -g serve

serve
serving /home/suda on port 3000
nc while :; do { echo -e 'HTTP/1.1 200 OK\n\nhello'; } | nc -l 8000; done
nc while :; do { echo -e 'HTTP/1.1 200 OK\n\n'; cat index.html; } | nc -l 8000; done


ワンライナーWebサーバを集めてみた - Qiita
<http://qiita.com/sudahiroshi/items/e74d61d939f18779970d>

・簡易サーバ

WebServerforChrome
KantanWEBServer
04WebServer
BlackJumboDog
XAMPP
MAMP
Tomcat

1~4まではWindows用ソフト(無償)です。
5~6は言語とDB環境を含めた環境です。
7はサーブレットコンテナなので正しくはサーバではありませんが、実質サーバの側面もあるため挙げました。
最終更新:2017年05月21日 15:05