Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning ASP.NET Core MVC Programming

You're reading from   Learning ASP.NET Core MVC Programming Learn the fundamentals of ASP.NET MVC and build real-world web applications using ASP.NET Core MVC

Arrow left icon
Product type Paperback
Published in Nov 2016
Publisher Packt
ISBN-13 9781786463838
Length 326 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Anuraj Parameswaran Anuraj Parameswaran
Author Profile Icon Anuraj Parameswaran
Anuraj Parameswaran
Mugilan T. S. Ragupathi Mugilan T. S. Ragupathi
Author Profile Icon Mugilan T. S. Ragupathi
Mugilan T. S. Ragupathi
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Introduction to ASP.NET Core FREE CHAPTER 2. Setting Up the Environment 3. Controllers 4. Views 5. Models 6. Validation 7. Routing 8. Beautifying ASP.NET MVC Applications with Bootstrap 9. Deployment of ASP.NET Core Application 10. Building HTTP-based Web Services Using ASP.NET Web API 11. Improving Performance of an ASP.NET Core Application 12. ASP.NET Core Identity

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image