-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nginx and kestrel setup docs for linux? #1170
Comments
+1 on a complete linux tutorial. @mw007 sounds like a redirect loop issue, could you show me your nginx config? |
I too have kestrel working from the command line, as long as I go to kestrel's port directly. When I try to use nginx as a proxy to kestrel is when things don't work. I did work on this a bit more and found that I get different results when running kestrel in daemon mode, as opposed to using @marce155 here is my nginx config. Thanks for looking into this. |
@mw007 your config looks fine actually... With this configuration it's running perfectly fine for me, as long as I start kestrel as my user and not daemonized as root (see also this issue). |
No problem Markus, thanks for looking. I do have an update on this though! I was able to get this working once I backed up a revision. This only works when I run If someone could close this ticket in the meantime, that would be awesome. I don't seem to have the privileges to do so. |
having the same problem using nginx to proxy_pass to kestrel for my mvc app. going directly to the port via the browser works. also i can nginx proxy_pass to aspnet sample (HelloMVC) app ONLY if Startup.cs has app.UseWelcomePage() invoked. If this line is removed then nginix + kestrel doesn't work (browser spins) but, again, going straight to the port does using 1.0.0-rc1-update1 can we keep this ticket open? |
@nguyenm100 you'll want to have a look at the workarounds section below. Try the second item listed and let me know if you have the same experience. I believe this to be a bug either in nginx itself, or in how kestrel communicates with nginx. Basically, nginx doesn't get the signal that kestrel is done serving a request, so the client connection remains open. If kestrel is shut down via These are the software versions I'm using
These are the steps to reproduceStart nginx using this config Change to the root directory of my app Start kestrel Then browse to http://localhost in a browser. Note that I have also browsed to the page from a Windows machine on the local network. I did this so that I could capture web traffic in fiddler4. This is the behaviour I'm experiencingThe browser "spins" as though it's waiting for the request to be served. Workarounds
Both solutions (while not ideal) will cause the pages to be served. I'm going to try using the latest nginx snapshot and see how that goes. There is a listing in their 1.9.9 changelog that mentions a bugfix while proxying to unix sockets. |
@mw007 -- thanks for posting this. I can get the samples/1.0.0-rc1-update1/HelloMvc to work using your workarounds. However, when I remove the "app.UseWelcomePage()" call from Startup.cs, it bombs but I did get a stack trace: InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.CompilationAbstractions.ILibraryExporter' while attempting to activate 'Microsoft.AspNet.Mvc.Razor.Compilation.RoslynCompilationService'. which looks like a known problem aspnet-contrib/AspNet.Security.OpenIdConnect.Server#190 btw- am on ubuntu 14.04.3 |
I got this to work per: aspnet/KestrelHttpServer#468 or aspnet/KestrelHttpServer#418 |
Thank you @nguyenm100! A comment from aspnet/KestrelHttpServer#418 did the trick for me. This is what I added to my nginx configuration file to solve the problem.
|
Purely for info as I had similar issues using HAProxy, I needed to add the following to the defaults section:
Apologies for being slightly off topic, but relevant. |
This might be helpful for this in the mean time: http://www.tugberkugurlu.com/archive/nginx-reverse-proxy-and-load-balancing-for-asp-net-5-applications-with-docker-compose |
I'm trying to setup nginx + kestrel in order to serve an ASP.NET 5 app from Linux Mint. Is there any guidance on this? I've read docs.asp.net/installing-on-linux, as well as, a two-part blog post written back in June here and here.
Right now, I have nginx setup to forward requests to kestrel on port 5000. Things seem to work (i.e. I can see kestrel working without error in a terminal), but the browser just spins. If I Ctrl+C to quit kestrel, the page is then sent to the browser and rendered. I've verified that this is indeed what's happening with Fiddler.
My goal is to have nginx and kestrel run in daemon mode, and automatically start at boot. Is this currently possible?
The text was updated successfully, but these errors were encountered: