[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Nginx and ASP.Net Core



Patrick Kirk wrote: 
> On Mon, 13 Dec 2021 at 13:37, Dan Ritter <dsr@randomstring.org> wrote:
> 
> > Patrick Kirk wrote:
> >
> > 6. If serving dynamic content, where to get it
> >
> >
> > A program running on port 5000 is a fine place to serve dynamic
> > content from, but you haven't told nginx about it.
> >
> > I'll bet you that this "kestrel" program comes with
> > documentation about using a reverse proxy, which is what you
> > want nginx to do.
> >
> > -dsr-
> >
> Hi Dan,
> 
> Nginx is working well for items 1 to 6 on your list.  I followed this
> tutorial:
> https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-6.0
> 
> As you can see from the logs, there is no problem serving static files.
> 
> But I can't find how to tell nginx where to get dynamic content.

It's right in that tutorial:

 location / {
        proxy_pass         http://127.0.0.1:5000;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For
$proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
    }



Reply to: