Loading...
Angular

Deploying Angular App in Production

Once you are done with development of your angular project in your local machine, now it’s time to build and deploy the same in production server. We can deploy angular build/project in any http server. In this article, I will explain how to deploy angular app in xampp or wamp or lamp server.

1. Build the project:

D:\Projects\first-angular-app> ng build first-angular-app -c production

This command will build the angular app and create a attributable package under dist/ first-angular-app directory. Copy the first-angular-app directory and paste it in server www folder.

2. Modify base tag:

Open the index.html file and modify the base tag as shown below –

<base href="/">
to
<base href="./">

That’s all. Now open browser and run the app using the following url –

http://localhost/first-angular-app/

You can replace localhost with production server dns if you are deploying the app in remote server.

Share this article with your friends
Leave a Reply

Your email address will not be published. Required fields are marked *