![nginx: [emerg] Die Direktive „worker_processes“ ist hier in /etc/nginx/conf.d/default.conf:1 in Angular 15 nicht zulässig?](https://rvso.com/image/792433/nginx%3A%20%5Bemerg%5D%20Die%20Direktive%20%E2%80%9Eworker_processes%E2%80%9C%20ist%20hier%20in%20%2Fetc%2Fnginx%2Fconf.d%2Fdefault.conf%3A1%20in%20Angular%2015%20nicht%20zul%C3%A4ssig%3F.png)
Ich stehe vor diesem Fehler,
nginx: [emerg] Die Direktive „worker_processes“ ist hier in /etc/nginx/conf.d/default.conf:1 nicht zulässig.
Docker-Datei:
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;"]
Dies ist meine nginx.conf-Datei:
Aktualisierte Konfigurationsdatei 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";
}
}
Ursprüngliche 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";
}
}
}
kann mir jemand helfen, wo ich falsch liege?
Antwort1
Dies ist tatsächlich nicht Ihre main
nginx.conf
Datei, sondern eine Konfigurationsdatei für Ihre (oder eine Ihrer) Websites.
Die Hauptkonfigurationsdatei, die die worker_process
Anweisung akzeptiert, befindet sich unter /etc/nginx/nginx.conf
.
Ihre http
und events
Anweisungen funktionieren auch unter nicht /etc/nginx/conf.d/default.conf
.
Die Standarddatei nginx.conf enthält bereits diese Anweisungen und die Arbeitsprozesse sind auf „auto“ eingestellt:
worker_processes auto;
Löschen Sie http, Ereignisse und Arbeitsprozesse aus Ihrer Website-Konfigurationsdatei und optimieren Sie diese Einstellungen in Ihrer Hauptdatei nginx.conf
.