Angular Project Deployment on Live Server

Posted at: December 15, 2018 6:56 PM

Deployment

Deploy your Angular application to a remote server.

Create a production build and copy the output directory to a web server.

  1. Start with the production build
  2. Copy everything within the output folder dist/ by default.
  3. Configure the server to redirect requests for missing files to index.html.

Server configuration

There is no single configuration that works for every server. The following sections describe configurations for some of the most popular servers.

Apache: add a rewrite rule to the .htaccess file as shown
Nginx: use try_files, as described in Front Controller Pattern Web Apps, modified to serve index.html
IIS: add a rewrite rule to web.config, similar to the one shown here
Firebase hosting: add a rewrite rule.

The base tag

In development, you typically start the server in the folder that holds index.html. That's the root folder and you'd add near the top of index.html because / is the root of the app.

But on the shared or production server, you might serve the app from a subfolder. For example, when the URL to load the app is something like http://www.mysite.com/my/app/, the subfolder is my/app/ and you should add to the server version of the index.html.

This lesson also available on YouTube
Deployment Live Server Production Environment


Angular 6/7 Tutorial in Hindi

Angular 7 is a JavaScript based framework for building web applications and apps in JavaScript, html, and TypeScript, which is a superset of JavaScript, used to create Single Page Applications.

truecodex.com provides video tutorial for enough understanding of all the necessary components of Angular 6 and Angular 7.

truecodex.com will keep uploading videos of the latest features of Angular. Please subscribe my channel for latest videos.


Please leave comments

5 Comments