Ajit Kumar
Ajit Kumar

Reputation: 590

How to deploy an angular 2/4 application on to web hosting?

I have created a local copy of angular 4 project and Now everything is working fine in local. So I just wanted to deploy the angular application to my shared web hosting to access globally, what should I do?

Upvotes: 1

Views: 3361

Answers (2)

Pardeep Jain
Pardeep Jain

Reputation: 86740

Also, don't forget to change base url in the index.html of build(dist) like this

<base href="./">

or you can simply call flag as well will running build command

ng build --base-href /myUrl/

Upvotes: 2

MD KAMRUL HASAN SHAHED
MD KAMRUL HASAN SHAHED

Reputation: 690

Open command prompt and goto project folder then run

ng build

To optimize for production use,

ng build --prod

more command can found here: https://angular.io/guide/deployment

This will generate a dist folder. Upload the content of dist folder to your web server wwwroot directory. Now you can access your Angular app.

Upvotes: 2

Related Questions