Answer the question
In order to leave comments, you need to log in
Docker nginx .dotnet how to configure correctly?
Hello, how to properly configure nginx as a reverse proxy, in docker, in conjunction with .net?
In general, deployed in docker nginx and .net
docker logs
2019/12/13 10:57:16 [error] 6#6: *9 connect() failed (113: No route to host) while connecting to upstream, client: 110.232. 92.44, server: , request: "GET / HTTP/1.1", upstream: " http://myip:80/ ", host: "178.88.161.76:8080"
110.232.92.44 - - [13/Dec/2019:10 :57:16 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36"
But problem in that I see the default nginx page
but not the aspnet
.net
dockerfile page
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-stretch-slim AS final
WORKDIR /app
COPY . .
EXPOSE 5000
ENTRYPOINT ["dotnet", "WebApplication4.dll"]
FROM nginx
COPY nginx.conf /etc/nginx/
worker_processes 4;
events { worker_connections 1024; }
http {
# Nginx will handle gzip compression of responses from the app server
gzip on;
gzip_proxied any;
gzip_types text/plain application/json;
gzip_min_length 1000;
server {
listen 8080;
# Nginx will reject anything not matching /api
location / {
proxy_pass http://10.2.10.6:80;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
}
}
Answer the question
In order to leave comments, you need to log in
proxy_pass http://10.2.10.6:80;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question