I'm testing net core app deployment to a Digitalocean droplet running Ubuntu 18.04 and Nginx 1.14. For testing, I'm using the templates available from 'dotnet new'.
The dotnet new web and dotnet new mvc apps work fine. I'm able to reach them from my browser. I'm having issues with the dotnet new webapi app. However I try to reach it, I end up with a ERR_CONNECTION_REFUSED response.
Short version of what I've done to setup my droplet:
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo add-apt-repository universe
sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install dotnet-sdk-2.2
sudo apt install nginx sudo ufw allow 'Nginx HTTP'
/etc/nginx/sites-available/default content:
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:5000; #also tried 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;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Results from curl (ip address intentionally derped)
curl -I -X GET http://123.123.123.123/api/values
HTTP/1.1 307 Temporary Redirect
Server: nginx/1.14.0 (Ubuntu)
Date: Sun, 19 May 2019 00:32:21 GMT
Content-Length: 0
Connection: keep-alive
Location: https://123.123.123.123:5001/api/values
My Nginx log gives me this error, which I've Googled to no avail:
2019/05/19 00:03:06 [error] 3632#3632: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 12.123.12.123, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "123.123.123.117"
In response to @Oliver's question, here's the output of netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3527/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 605/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 946/sshd
tcp6 0 0 :::22 :::* LISTEN 946/sshd
Any suggestions as to what I might be overlooking?
Thanks!