I have been encountering problem regarding deployment of Angular ssr on Apache.
I believe, configuration on apache is needed alongwith .htaccess file.
Below are some links which I have been through, but either I was not able to configure or the description was not thorough enough to implement.
https://github.com/angular/universal-starter/issues/514
Angular2 Universal deploy to apache remote server
How to properly launch Angular Universal to live server
How to deploy Angular Universal project to standard hosting?
My issue is deploying Angular Universal on Apache server with port configured to 8080 and inside a directory ‘custom’ — x.x.x.x:8080/custom
Steps Taken
1) Deployed dist/* to /var/www/html/custom
2) npm install to install deps
3) pm2 to start server.js under dist folder
Navigating to x.x.x.x:8080/custom gives the directory structure instead.
I think I need to redirect requests to the port that the app started with PM2 is listening on.
How shall that be done is my concern
Help much appreciated !!
2
Answers
You can map apache server with pm2 server:
This will route all request from apache server to your pm2 server
We are using pm2 ecosystem to point localhost
First enable mod_proxy and mod_proxy_http in httpd.conf!
If you are using virtual host add the following proxy setting to your domain-specific host file-
Restart your Apache and pm2
So if you accessing your live domain e.g http://www.example.com will serve by pm2 through localhost:4200