From cecbb38a40f5be5f015c8d97e2611e0a513a4bb3 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Wed, 17 Sep 2025 12:24:54 +0800 Subject: [PATCH] =?UTF-8?q?refactor(nginx):=20=E8=B0=83=E6=95=B4nginx?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=BD=8D=E7=BD=AE=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=85=8D=E7=BD=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将worker_rlimit_nofile配置移到http块之前,并修改Dockerfile中的nginx配置文件路径 --- Dockerfile | 3 +-- nginx.conf | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 07a7497..df560bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,8 +28,7 @@ FROM nginx:1.29.1-alpine3.22 AS production-stage # 将构建好的项目复制到nginx下 COPY --from=builder /app/dist/build/h5 /usr/share/nginx/html -# 将默认的nginx配置文件替换为我们自定义的nginx配置文件 -COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/nginx.conf # 暴露端口 EXPOSE 80 diff --git a/nginx.conf b/nginx.conf index e6e5ecb..b20b4d9 100644 --- a/nginx.conf +++ b/nginx.conf @@ -11,6 +11,9 @@ events { use epoll; } +# 文件描述符限制 - 移到这里,在http块之前 +worker_rlimit_nofile 65535; + http { # 日志格式定义 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' @@ -46,9 +49,6 @@ http { client_header_timeout 60s; client_body_timeout 60s; - # 文件描述符限制 - worker_rlimit_nofile 65535; - server { listen 80; server_name _;