Configuring the Nginx server
Configure the Nginx server by modifying the file (/etc/nginx/sites-available/default
) to have the following content—so that Nginx will forward the request to ASP.NET. In order to modify this file, you need to have sufficient rights—try switching to a super user. The
Sudo su
is the command for switching it to a super user. See the following code:
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; } }
The code looks like the following:
Run the application by executing the following command:
dotnet run
You will see the following screen:
Now access the application from your browser using the public DNS (AWS created the public DNS when the instance was launched):
Voila! We have created the ASP.NET Core...