I'm having problem when deploying my web application to Apache remote server. I've achieved deploying a standard Angular2 web application which use a RESTful API service (written in PHP, hosted at /public_html/api) by these steps:
- Open command line at project directory, run
ng build --prod
- Copy everything inside dist/ directory into remote server /public_html/
- Copy
.htaccess
file from here to the same location on remote server - Web application and getting data from RESTful API work
However, I need to integrate Angular2 Universal into project, so I followed the instructions in Angular Sever Side Rendering and this GitHub wiki. But after all, I only can integrate and run universal project on my local machine with port 4000, as the tutorial shown. I don't know how to properly deploy it to Apache remote server and config .htaccess
file. Theses are steps I took but didn't work as I expected:
- On my local machine, run
npm build...
to create dist/ folder which has browser/ and server/ folder andserver.js
file - Copy whole dist/ folder to /public_html/
- Using Putty, SSH to remote server and at public_html directory, I
run
node dist/server.js
- I got log "Node server listening on http://localhost:4000"
- Then, I go to my browser and type in http://my_server_ip:4000 but surely nothing show up. The browser keep loading and when I open console F12 on Firefox there are no error or any log show.
I need to integrate Angular2 Universal Server Side Rendering because Google crawler cannot index my web project, it's only load data when real user go into website. Please help, thank you!