Deployment
When you are ready to deploy your Angular Application to a remote server, you
have various options for deployment.
Basic deployment to a remote server
For the simplest deployment, create a production build and copy the output
directory to a web server.
- Start with the production build:
ng build
- Copy everything within the output folder
(dist/project-name/ by default) to a folder on the server
- Configuration the server to redirects requests for missing files to
index.html
.
For Example, if the index.html
is on the server at
/my/app.index.html
, set the base href to
<base href="/my/app/">
like this.
If you're serving the app out of a subfolder, edit a version of inddex.html to set
the base href appropriately. For Example, if the URL to
index.html
is
www.abc.com/my/app/index.html
, set the base href to
<base href="/my/app/">
You can also set the base href right in the
ng build
command.
ng build --base-href="/my/app/"
This is the simplest production-ready deployment of your application. For more
detailes information, visit this official
Angular Documentation
Website.