Portál AbcLinuxu, 26. října 2025 18:26
python -m http.server 8000. A třeba PHP má totéž.
# http-server --help
usage: http-server [path] [options]
options:
-p Port to use [8080]
-a Address to use [0.0.0.0]
-d Show directory listings [true]
-i Display autoIndex [true]
-e --ext Default file extension if none supplied [none]
-s --silent Suppress log messages from output
--cors[=headers] Enable CORS via the "Access-Control-Allow-Origin" header
Optionally provide CORS headers list separated by commas
-o [path] Open browser window after starting the server
-c Cache time (max-age) in seconds [3600], e.g. -c10 for 10 seconds.
To disable caching, use -c-1.
-U --utc Use UTC time format in log messages.
-P --proxy Fallback proxy if the request cannot be resolved. e.g.: http://someurl.com
-S --ssl Enable https.
-C --cert Path to ssl cert file (default: cert.pem).
-K --key Path to ssl key file (default: key.pem).
-r --robots Respond to /robots.txt [User-agent: *\nDisallow: /]
-h --help Print this list and exit.
# serve --help
Usage: serve [options] [command]
Commands:
help Display help
Options:
-a, --auth Serve behind basic auth
-c, --cache n How long static files should be cached in the browser (seconds) (defaults to 3600)
-o, --cors Setup * CORS headers to allow requests from any origin (disabled by default)
-h, --help Output usage information
-i, --ignore Files and directories to ignore (defaults to "")
-p, --port Port to listen on
-s, --single Serve single page apps with only one index.html
-u, --unzipped Disable GZIP compression
-v, --version Output the version number
Jinak nginx je IMHO také dost minimalistický, s Apache neporovnatelný.
Jinak pozor na to, že i pro jednoduchou SPA můžete celkem brzo potřebovat pokročilejší fce (https, kompresi, autorizaci, různé cachovací a CORS hlavičky, SPDY, QUIC, HTTP/2 či dokonce HTTP/3, WebSockety...).
busybox -fp8080
22 řádků cčka hele a navíc to je jakoby i uplně zdálky vidět žeto je http server :O :O :D :D :D ;D
github hele
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.