![nginx: [emerg] "worker_processes" 지시문은 각도 15의 /etc/nginx/conf.d/default.conf:1에서 허용되지 않습니까?](https://rvso.com/image/792433/nginx%3A%20%5Bemerg%5D%20%22worker_processes%22%20%EC%A7%80%EC%8B%9C%EB%AC%B8%EC%9D%80%20%EA%B0%81%EB%8F%84%2015%EC%9D%98%20%2Fetc%2Fnginx%2Fconf.d%2Fdefault.conf%3A1%EC%97%90%EC%84%9C%20%ED%97%88%EC%9A%A9%EB%90%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EA%B9%8C%3F.png)
이 오류가 발생했습니다.
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
.
귀하의 http
및 events
지시문은 에서도 작동하지 않습니다 /etc/nginx/conf.d/default.conf
.
기본 nginx.conf 파일에는 이미 이러한 지시문이 포함되어 있으며 작업자 프로세스는 자동으로 설정되어 있습니다.
worker_processes auto;
웹사이트 구성 파일에서 http, events 및 Worker_processes를 삭제하고 기본 nginx.conf
파일 내에서 해당 설정을 조정하세요.