> sudo nginx -t
Success
> systemctl reboot
> sudo systemctl start nginx
> sudo systemctl status nginx
Active
So until here, everything works.
Then I get my VM IP :
> ip a
192.168.1.17
Now, the issue is that when I try to run the published app I get a connection timed out error whether I use localhost:5000 or 192.168.1.17:5000 :
If the app runs on the server but fails to respond over the Internet, check the server's firewall and confirm that port 80 is open. If using an Azure Ubuntu VM, add a Network Security Group (NSG) rule that enables inbound port 80 traffic. There's no
need to enable an outbound port 80 rule, as the outbound traffic is automatically granted when the inbound rule is enabled.
So I installed ufw and did
> sudo ufw allow "Nginx Full"
But even after having rebooted, it still doesn't work on Windows or my phone through WiFi.
Do I have to use Kestrel absolutely for a local VM ?
Typically port 5000 would be blocked by firewall rules. to check if the asp.net core app is running in the vm and supports port 5000, from console in the vm
Member
3 Points
40 Posts
Deploying ASP.NET Core to a Linux VM with Nginx
Dec 19, 2020 08:17 PM|valenciano8|LINK
Hi everyone,
I'm following this tutorial in order to deploy an ASP.NET Core app to a Linux VM :
https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-3.1
I'm using CentOS 8 Stream and Nginx.
But I'm facing an issue.
Indeed I have my app in my user folder :
I've then added the HttpHeaders to the Startup.cs file :
And then built and published my app like so :
Also I have set up Nginx like the tutorial :
And the following :
So until here, everything works.
Then I get my VM IP :
Now, the issue is that when I try to run the published app I get a connection timed out error whether I use localhost:5000 or 192.168.1.17:5000 :
If the app runs on the server but fails to respond over the Internet, check the server's firewall and confirm that port 80 is open. If using an Azure Ubuntu VM, add a Network Security Group (NSG) rule that enables inbound port 80 traffic. There's no need to enable an outbound port 80 rule, as the outbound traffic is automatically granted when the inbound rule is enabled.
So I installed ufw and did
But even after having rebooted, it still doesn't work on Windows or my phone through WiFi.
Do I have to use Kestrel absolutely for a local VM ?
All-Star
57834 Points
15485 Posts
Re: Deploying ASP.NET Core to a Linux VM with Nginx
Dec 19, 2020 09:12 PM|bruce (sqlwork.com)|LINK
I don’t see where you started the asp.net core app, typically also with systemctl . It needs to be running for nginx to reverse proxy to it.
Member
3 Points
40 Posts
Re: Deploying ASP.NET Core to a Linux VM with Nginx
Dec 19, 2020 10:26 PM|valenciano8|LINK
Hi @Bruce,
I did the following in my VM :
And then tried 192.168.1.17:5000 inside Windows but it doesn't work.
All-Star
57834 Points
15485 Posts
Re: Deploying ASP.NET Core to a Linux VM with Nginx
Dec 20, 2020 08:32 PM|bruce (sqlwork.com)|LINK
Typically port 5000 would be blocked by firewall rules. to check if the asp.net core app is running in the vm and supports port 5000, from console in the vm
Member
3 Points
40 Posts
Re: Deploying ASP.NET Core to a Linux VM with Nginx
Dec 20, 2020 09:49 PM|valenciano8|LINK
Hi @bruce,
Well I did the following :
All-Star
57834 Points
15485 Posts
Re: Deploying ASP.NET Core to a Linux VM with Nginx
Dec 21, 2020 03:34 PM|bruce (sqlwork.com)|LINK
Should of had html for the body. Use the -v switch to see the headers
Member
3 Points
40 Posts
Re: Deploying ASP.NET Core to a Linux VM with Nginx
Dec 22, 2020 01:33 PM|valenciano8|LINK
Hi @bruce,
I get this :
All-Star
57834 Points
15485 Posts
Re: Deploying ASP.NET Core to a Linux VM with Nginx
Dec 22, 2020 03:37 PM|bruce (sqlwork.com)|LINK
Pretty clear you app to having an issue. What do your error logs show. You could enable the dev error page if you haven’t yet added proper logging