[英]nginx container: unknown directive "events", .conf error
I'm using a nginx container with docker lihe proxy server.我正在使用带有 docker lihe 代理服务器的 nginx 容器。 The real function is redirect the request from http://127.0.0.1:7003 to my asp .net rest app with expose port in 5000.
真正的功能是将请求从http://127.0.0.1:7003重定向到我的 asp .net rest 应用程序,并在 5000 中公开端口。
So I have been investigating where is the sintaxys error and what is happening.所以我一直在调查 sintaxys 错误在哪里以及发生了什么。
nginx-container | 2020/01/28 08:34:06 [emerg] 1#1: unknown directive "events" in /etc/nginx/conf.d/Local.Project.Core.conf:1
nginx-container | nginx: [emerg] unknown directive "server" in /etc/nginx/conf.d/Local.Project.Core.conf:1
So there is my nginx Dockerfile:所以有我的 nginx Dockerfile:
FROM nginx:latest
# Copy virtual hosts config
RUN rm /etc/nginx/conf.d/default.conf
COPY ./wwwroot/config/Local.Project.Core.conf /etc/nginx/conf.d/
My docker compose where I put the connexions:我的 docker compose 放置连接的位置:
local-project:
image: project-mysql-image
container_name: project-mysql-container
ports:
- 127.0.0.1:7000:80
- 127.0.0.1:7001:433
- 127.0.0.1:7002:5000
expose:
- "5000"
environment:
ASPNETCORE_ENVIRONMENT: Production
ASPNETCORE_URLS: http://+:80;http//+:433;http:+:5000 # Is going to use Kestrel standard 5000 port, only http connection
ASPNETCORE_Kestrel__Certificates__Default__Path: /etc/ssl/certs/Local.Proyect.Core.pfx
ASPNETCORE_Kestrel__Certificates__Default__Password: local
volumes:
- .\wwwroot\cer\Local.Proyect.Core.cer:/etc/ssl/certs/Local.Proyect.Core.pfx
nginx:
image: nginx-image
container_name: nginx-container
ports:
- 127.0.0.1:7003:80
And the most important, the file.conf:最重要的是 file.conf:
events {
worker_connections 1024;
multi_accept on;
use epoll;
}
http {
include /etc/nginx/sites-enabled/*;
upstrem project-mysql-container { server project-mysql-container:5000; }
server {
listen 80;
root /;
index index.html index.htm index.nginx-debian.html;
server_name *.Local.Project.Core;
location / {
proxy_pass http://project-mysql-container:5000;
}
location /ws/ {
proxy_pass http://project-mysql-container:5000/ws/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
}
In your nginx configuration, you have upstrem project-mysql-container ...
.在您的 nginx 配置中,您有
upstrem project-mysql-container ...
。 That upstrem
should be upstream
.也就是说
upstrem
应该是upstream
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.