← 返回命令列表

Linux command

hypercorn 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Run ASGI application

hypercorn [app:app]

Specify host and port

hypercorn [app:app] --bind [0.0.0.0:8000]

Run with multiple workers

hypercorn [app:app] --workers [4]

Enable reload for development

hypercorn [app:app] --reload

Use HTTPS

hypercorn [app:app] --certfile [cert.pem] --keyfile [key.pem]

HTTP/2 support

hypercorn [app:app] --certfile [cert.pem] --keyfile [key.pem]

说明

Hypercorn is an ASGI server supporting HTTP/1.1, HTTP/2, and WebSockets. It runs ASGI applications like FastAPI, Starlette, and Quart with optional HTTP/2 and HTTPS support. Hypercorn supports multiple async frameworks (asyncio, uvloop, trio) and provides production-ready features including worker processes and graceful shutdown.

参数

--bind, -b _address_
Address to bind (host:port).
--workers, -w _n_
Number of worker processes.
--reload
Auto-reload on code changes.
--access-log _file_
Access log file.
--error-log _file_
Error log file.
--certfile _file_
SSL certificate.
--keyfile _file_
SSL key file.
--worker-class _class_
Worker type: asyncio, uvloop, trio.
--graceful-timeout _seconds_
Graceful shutdown timeout.

FAQ

What is the hypercorn command used for?

Hypercorn is an ASGI server supporting HTTP/1.1, HTTP/2, and WebSockets. It runs ASGI applications like FastAPI, Starlette, and Quart with optional HTTP/2 and HTTPS support. Hypercorn supports multiple async frameworks (asyncio, uvloop, trio) and provides production-ready features including worker processes and graceful shutdown.

How do I run a basic hypercorn example?

Run `hypercorn [app:app]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --bind, -b _address_ do in hypercorn?

Address to bind (host:port).