I've been looking for about 3 hours for hosting an Angular 4 app on a server with "server-side rendering" enabled. For note - I have a AWS server which has Apache installed (Ubuntu).
First of all, I already know how can we host an Angular 4 app (without server-side rendering). But here my major concern is that I want to enable my app to be enabled for - server-side rendering.
In my local, I use npm start command, which automatically serves the app (with server-side rendering enabled) on - http://localhost:4000
My package.json file looks like this:
...
"scripts": {
"serve": "ng serve",
"prestart": "ng build --prod && ngc && webpack",
"start": "node dist/server.js",
"build": "ng build"
},
...
These all commands are working fine. But I'm confused that should I again run
npm start
on a production server, so that it also requires node_modules to install. Which doesn't seems the right way to me?
Can anyone please help me with hosting my app with "server-side rendering" enabled.

Actually it's very simple.
Use a shell to go to the directory of your angular 4 project. and do this:
This will compile the application and the result is in the dist folder at the root of your angular application.
Now you just have to put the content of the dist folder in a HTTP server and eat popcorn.
Cdly, Jerry Yong-busson.