Просмотр исходного кода

refactor(nginx): 调整nginx配置文件位置并优化配置结构

将worker_rlimit_nofile配置移到http块之前,并修改Dockerfile中的nginx配置文件路径
feige996 7 месяцев назад
Родитель
Сommit
cecbb38a40
2 измененных файлов с 4 добавлено и 5 удалено
  1. 1 2
      Dockerfile
  2. 3 3
      nginx.conf

+ 1 - 2
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

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