{"id":18452166,"url":"https://github.com/praharshjain/http-server-one-liners","last_synced_at":"2026-03-11T02:31:38.625Z","repository":{"id":157934394,"uuid":"95311904","full_name":"praharshjain/http-server-one-liners","owner":"praharshjain","description":"List of http static server one-liners","archived":false,"fork":false,"pushed_at":"2017-07-03T16:46:49.000Z","size":4,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-06T07:39:49.601Z","etag":null,"topics":["ad-hoc","adhoc","http-server","one-liners","oneliners","server","static-server","web-server","webserver"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/praharshjain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-24T17:16:00.000Z","updated_at":"2023-03-27T16:30:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"6f6971e5-c7c2-415b-aa0f-7894e506c359","html_url":"https://github.com/praharshjain/http-server-one-liners","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fhttp-server-one-liners","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fhttp-server-one-liners/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fhttp-server-one-liners/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/praharshjain%2Fhttp-server-one-liners/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/praharshjain","download_url":"https://codeload.github.com/praharshjain/http-server-one-liners/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247764921,"owners_count":20992200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ad-hoc","adhoc","http-server","one-liners","oneliners","server","static-server","web-server","webserver"],"created_at":"2024-11-06T07:30:10.458Z","updated_at":"2026-03-11T02:31:38.546Z","avatar_url":"https://github.com/praharshjain.png","language":null,"readme":"http-server-one-liners\n==========\n\nList of http static server one-liners\n\nEach of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.\n\n### Python 2.x\n\n```shell\n$ python -m SimpleHTTPServer 8000\n```\n\n### Python 3.x\n\n```shell\n$ python -m http.server 8000\n```\n\n### Twisted \u003csub\u003e\u003csup\u003e(Python)\u003c/sup\u003e\u003c/sub\u003e\n\n```shell\n$ twistd -n web -p 8000 --path .\n```\n\nOr:\n\n```shell\n$ python -c 'from twisted.web.server import Site; from twisted.web.static import File; from twisted.internet import reactor; reactor.listenTCP(8000, Site(File(\".\"))); reactor.run()'\n```\n\nDepends on [Twisted](http://twistedmatrix.com/trac/wiki/Downloads).\n\n### Ruby\n\n```shell\n$ ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port =\u003e 8000, :DocumentRoot =\u003e Dir.pwd).start'\n```\n\n### Ruby 1.9.2+\n\n```shell\n$ ruby -run -ehttpd . -p8000\n```\n\n### adsf \u003csub\u003e\u003csup\u003e(Ruby)\u003c/sup\u003e\u003c/sub\u003e\n\n```shell\n$ gem install adsf   # install dependency\n$ adsf -p 8000\n```\n\n*No directory listings.*\n\n### Sinatra \u003csub\u003e\u003csup\u003e(Ruby)\u003c/sup\u003e\u003c/sub\u003e\n\n```shell\n$ gem install sinatra   # install dependency\n$ ruby -rsinatra -e'set :public_folder, \".\"; set :port, 8000'\n```\n\n*No directory listings.*\n\n### Perl\n\n```shell\n$ cpan HTTP::Server::Brick   # install dependency\n$ perl -MHTTP::Server::Brick -e '$s=HTTP::Server::Brick-\u003enew(port=\u003e8000); $s-\u003emount(\"/\"=\u003e{path=\u003e\".\"}); $s-\u003estart'\n```\n\n### Plack \u003csub\u003e\u003csup\u003e(Perl)\u003c/sup\u003e\u003c/sub\u003e\n\n```shell\n$ cpan Plack   # install dependency\n$ plackup -MPlack::App::Directory -e 'Plack::App::Directory-\u003enew(root=\u003e\".\");' -p 8000\n```\n\n### Mojolicious \u003csub\u003e\u003csup\u003e(Perl)\u003c/sup\u003e\u003c/sub\u003e\n\n```shell\n$ cpan Mojolicious::Lite   # install dependency\n$ perl -MMojolicious::Lite -MCwd -e 'app-\u003estatic-\u003epaths-\u003e[0]=getcwd; app-\u003estart' daemon -l http://*:8000\n```\n\n*No directory listings.*\n\n### http-server \u003csub\u003e\u003csup\u003e(Node.js)\u003c/sup\u003e\u003c/sub\u003e\n\n```shell\n$ npm install -g http-server   # install dependency\n$ http-server -p 8000\n```\n\n*Note: This server does funky things with relative paths. For example, if you have a file `/tests/index.html`, it will load `index.html` if you go to `/test`, but will treat relative paths as if they were coming from `/`.*\n\n### node-static \u003csub\u003e\u003csup\u003e(Node.js)\u003c/sup\u003e\u003c/sub\u003e\n\n```shell\n$ npm install -g node-static   # install dependency\n$ static -p 8000\n```\n\n*No directory listings.*\n\n### PHP \u003csub\u003e\u003csup\u003e(\u003e= 5.4)\u003c/sup\u003e\u003c/sub\u003e\n\n```shell\n$ php -S 127.0.0.1:8000\n```\n\n*No directory listings.*\n\n### Erlang\n\n```shell\n$ erl -s inets -eval 'inets:start(httpd,[{server_name,\"NAME\"},{document_root, \".\"},{server_root, \".\"},{port, 8000},{mime_types,[{\"html\",\"text/html\"},{\"htm\",\"text/html\"},{\"js\",\"text/javascript\"},{\"css\",\"text/css\"},{\"gif\",\"image/gif\"},{\"jpg\",\"image/jpeg\"},{\"jpeg\",\"image/jpeg\"},{\"png\",\"image/png\"}]}]).'\n```\n\n*No directory listings.*\n\n### busybox httpd\n\n```shell\n$ busybox httpd -f -p 8000\n```\n\n### webfs\n\n```shell\n$ webfsd -F -p 8000\n```\n\nDepends on [webfs](http://linux.bytesex.org/misc/webfs.html).\n\n### IIS Express\n\n```shell\nC:\\\u003e \"C:\\Program Files (x86)\\IIS Express\\iisexpress.exe\" /path:C:\\MyWeb /port:8000\n```\n\nDepends on [IIS Express](http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-express-overview).\n\n*No directory listings. `/path` must be an absolute path.*\n  \n### Clojure\n```\n$ lein simpleton 8080\n```\n### Spark(Go)\n```\n$ go get github.com/rif/spark\n$ spark -port 8000 .\n``` \n### PowerShell\n```\n$Hso=New-Object Net.HttpListener;$Hso.Prefixes.Add(\"http://+:8000/\");$Hso.Start();While ($Hso.IsListening){$HC=$Hso.GetContext();$HRes=$HC.Response;$HRes.Headers.Add(\"Content-Type\",\"text/plain\");$Buf=[Text.Encoding]::UTF8.GetBytes((GC (Join-Path $Pwd ($HC.Request).RawUrl)));$HRes.ContentLength64=$Buf.Length;$HRes.OutputStream.Write($Buf,0,$Buf.Length);$HRes.Close()};$Hso.Stop()\n```\n### NPM\n```\n$ npm install -g beefy\n$ beefy\n```\n### Rack (ruby)\n```\ngem install rack --no-ri --no-rdoc\nrackup -b 'use Rack::Static, :index =\u003e 'README.html'; run Rack::File.new('.')\"\n```\n### Djangothis (Python)\n```\n$ pip install djangothis\n$ djangothis\n```\n### OCaml\n```\n$ opam install cohttp async\n$ cohttp-server-async\n```\n### Docker\n```\ndocker run -d -p 8080:80 --name my-apache-app -v \"$PWD\":/usr/local/apache2/htdocs/ httpd:2.4-alpine\n```\n### R\n\nUsing the servr package:\n```\n$ Rscript -e 'servr::httd()' -p8000\n```\n\nLicense\n----------------\nMIT\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraharshjain%2Fhttp-server-one-liners","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpraharshjain%2Fhttp-server-one-liners","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpraharshjain%2Fhttp-server-one-liners/lists"}