nginx: [emerg] "worker_processes" 지시문은 각도 15의 /etc/nginx/conf.d/default.conf:1에서 허용되지 않습니까?

nginx: [emerg] "worker_processes" 지시문은 각도 15의 /etc/nginx/conf.d/default.conf:1에서 허용되지 않습니까?

이 오류가 발생했습니다.

nginx: [emerg] "worker_processes" 지시문은 /etc/nginx/conf.d/default.conf:1에서 허용되지 않습니다.

도커 파일:

FROM artifactorycloud.ual.com/v-docker/node:16 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build --configuration=development
FROM artifactorycloud.ual.com/v-docker/nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy the nginx conf that we created to the container
COPY ./nginx.conf  /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

이것은 내 nginx.conf 파일입니다.

업데이트된 구성 파일 서버 { Listen 80; 서버 이름 로컬 호스트;

        root   /usr/share/nginx/html;
        index  index.html index.htm;
        include /etc/nginx/mime.types;

        gzip on;
        gzip_min_length 1000;
        gzip_proxied expired no-cache no-store private auth;
        gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        location / {
            try_files $uri $uri/ /index.html;
        }

        location /ui/health {
            access_log off;
            add_header 'Content-Type' 'text/plain';
            return 200 "Healthy\n";
        }
    }

원본 nginx.conf

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    server {
        listen 80;
        server_name  localhost;

        root   /usr/share/nginx/html;
        index  index.html index.htm;
        include /etc/nginx/mime.types;

        gzip on;
        gzip_min_length 1000;
        gzip_proxied expired no-cache no-store private auth;
        gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        location / {
            try_files $uri $uri/ /index.html;
        }

        location /ui/health {
            access_log off;
            add_header 'Content-Type' 'text/plain';
            return 200 "Healthy\n";
        }
    }
}

내가 틀린 부분에 대해 누구든지 나를 도울 수 있습니까?

답변1

이는 실제로 귀하의 main nginx.conf파일이 아니라 귀하(또는 귀하의 웹사이트 중 하나)에 대한 구성 파일입니다.

지시문을 허용하는 기본 구성 파일 worker_process/etc/nginx/nginx.conf.

귀하의 httpevents지시문은 에서도 작동하지 않습니다 /etc/nginx/conf.d/default.conf.

기본 nginx.conf 파일에는 이미 이러한 지시문이 포함되어 있으며 작업자 프로세스는 자동으로 설정되어 있습니다.

worker_processes  auto;

웹사이트 구성 파일에서 http, events 및 Worker_processes를 삭제하고 기본 nginx.conf파일 내에서 해당 설정을 조정하세요.

관련 정보