Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

deploy asp.net core to linux nginx

$
0
0

Hi all,

I tried to deploy asp.net core web api to nginx in ubuntu follow the documentation below

https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction

When create the service file and start the service as below

systemctl start kestrel-hellomvc.service

the documentation said http://localhost will have the response header below

HTTP/1.1 200 OK
Date: Tue, 11 Oct 2016 16:22:23 GMT
Server: Kestrel
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked

but when I open http://localhost, I can see the response header as below

Connection: Keep-Alive

Content-Length: "0"

Date: "Tue, 07 Feb 2017 16:30:33 GMT"

Server: "nginx/1.10.1 (Ubuntu)"

---------------------------------------------

my application is an asp.net core web api, just an empty project, haven't write any code after created.

I can see hellomvc.servic is active

my default file as below

server {
    listen 80;
    location / {
        proxy_pass http://localhost: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;
    }
}

my service file as below

[Unit]
    Description=Example .NET Web API Application running on Ubuntu

    [Service]
    WorkingDirectory=/home/allen/Documents/helloworld
    ExecStart=/usr/bin/dotnet /home/allen/Documents/helloworld/helloworld.dll
    Restart=always
    RestartSec=10
    SyslogIdentifier=dotnet-example
    User=www-data
    Environment=ASPNETCORE_ENVIRONMENT=Production

    [Install]
    WantedBy=multi-user.target

the files in /home/allen/Documents/helloworld folder are the files which I copied from publish folder from dev environment

what's wrong with my config?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>