skip to Main Content

Currently I am running NodeJs server as background process in the host machine to achieve sender side rendering for my angular app.

On Linux for e.g. npm rum server & (ampersand is to put process in background)

But I am looking for solution like Apache Server that manages it start/stop with host reboot.

4

Answers


  1. I think the best way for you to acheive what you’re looking for is to use a management solution like PM2 or Forvever. These will pretty easily manage your solution in the background for you.

    Login or Signup to reply.
  2. Yes. You should be able to.

    Start by creating a proper deployment directory – https://angular.io/guide/deployment

    Then copy/ftp/whatever to the web server.

    The tricky part is in your route controllers, etc. and getting all of the paths right if you end up deploying into a different directory than what you developed for.

    Login or Signup to reply.
  3. Rather than apache/nginx managing start stop of your node application, you may create service to run your node application. It will run without any manual intervention.

    1. Start your Node app on some other port than 80, as your main web server might be running on that port.
    2. Create a service file in /etc/init to start your Node app
    3. Configure apache/nginx with reverse proxy to the node applicaiton
    4. Start both of the services: ‘service start nodeapp.conf’ and ‘service start apache2’

    This would make your life for handling these services pretty easy.

    Login or Signup to reply.
  4. You need to use Apache/Ngnix with NodeJS using proxy.

    Look into this link, if this helps:
    https://blog.daudr.me/painless-angular-ssr/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search