小编use*_*045的帖子

docker run 命令结束于: nginx: [emerg] 未知指令“events” in /etc/nginx/nginx.conf:1

我已在桌面 Windows 10 操作系统中从 Ubuntu bash shell 安装了 nginx-extras ,需要为 ASP.NET Core 3.1 Blazor Web 程序集应用程序启动 docker 容器来提供静态网页服务。我的 nginx.conf:

 events { }
   http {
      include mime.types;
      types {
         application/wasm wasm;
       }
     server {
        listen 80;
        index index.html;
        location / {
           root /var/www/web;
           try_files $uri $uri/ /index.html =404;
        }
     }
}
Run Code Online (Sandbox Code Playgroud)

Dockerfile:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
COPY . ./
RUN dotnet publish -c Release -o output

FROM nginx:alpine
WORKDIR /var/www/web
COPY --from=build-env /app/output/wwwroot .
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 …
Run Code Online (Sandbox Code Playgroud)

containers config nginx server-sent-events docker

2
推荐指数
1
解决办法
2995
查看次数

标签 统计

config ×1

containers ×1

docker ×1

nginx ×1

server-sent-events ×1