This commit is contained in:
jinql
2025-09-04 21:41:05 +08:00
parent ae73b2cd4a
commit 38c681b553
6 changed files with 32 additions and 156 deletions

View File

@@ -8,7 +8,7 @@ import yaml
bind = "0.0.0.0:8000"
# Worker 进程数(推荐 CPU 核心数 * 2 + 1
workers = 4
workers = 2
# 工作模式sync、gevent、uvicorn.workers.UvicornWorker
worker_class = "uvicorn.workers.UvicornWorker"
@@ -17,6 +17,9 @@ worker_class = "uvicorn.workers.UvicornWorker"
log_dir = Path("logs")
log_dir.mkdir(exist_ok=True)
# 允许来自这些IP的代理转发
forwarded_allow_ips = "*"
# 日志配置
with open(Path(__file__).with_name("logging.yaml"), "r", encoding="utf-8") as f:
logconfig_dict = yaml.safe_load(f)
@@ -36,10 +39,10 @@ raw_env = [
"UVICORN_ACCESS_LOGFORMAT=%(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s \"%(f)s\" \"%(a)s\" %(D)s"
]
# 可选:超时时间(秒)
# 超时时间(秒)
timeout = 120
# Keep - Alive超时
# Keep-Alive超时
keepalive = 5
# 进程名ps aux 中显示)