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 _;