I need to configure virtual host for angular2. I have tried following this article
https://www.packtpub.com/mapt/book/Web+Development/9781783983582/2/ch02lvl1sec15/Configuring+Apache+for+Angular
According to this i need to setup virtual host like this
<VirtualHost *:80>
ServerName my-app
DocumentRoot /path/to/app
<Directory /path/to/app>
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html
# to allow html5 state links
RewriteRule ^ index.html [L]
</Directory>
</VirtualHost>
Can anyone tell me what should be the path to app as my app is running on default angular 2 port that is 4200. Is there any other way to do it.
ng build --prodand upload the contents of the dist folder to your apache server document root for that virtual host.distfolder just like any other website you upload that content and serve that via apache and make sure all .html files load via index.html. What you are talking about is the local test server that is created when running Angular in a test environment you won't be using NodeJS to serve the Angular2 app you will be using your Apache server. Theng serveis just for serving the local development server it has nothing to do with Angular. You are using angular-cli right?